Skip to content

[ConstraintSystem] Overload choice should not be required to refer to… #23997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions lib/Sema/CSSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4232,13 +4232,13 @@ fixMemberRef(ConstraintSystem &cs, Type baseTy,
DeclName memberName, const OverloadChoice &choice,
ConstraintLocator *locator,
Optional<MemberLookupResult::UnviableReason> reason = None) {
if (!choice.isDecl())
return nullptr;

auto *decl = choice.getDecl();
if (auto *CD = dyn_cast<ConstructorDecl>(decl)) {
if (auto *fix = validateInitializerRef(cs, CD, locator))
return fix;
// Not all of the choices handled here are going
// to refer to a declaration.
if (choice.isDecl()) {
if (auto *CD = dyn_cast<ConstructorDecl>(choice.getDecl())) {
if (auto *fix = validateInitializerRef(cs, CD, locator))
return fix;
}
}

if (reason) {
Expand All @@ -4248,7 +4248,8 @@ fixMemberRef(ConstraintSystem &cs, Type baseTy,
return AllowTypeOrInstanceMember::create(cs, baseTy, memberName, locator);

case MemberLookupResult::UR_Inaccessible:
return AllowInaccessibleMember::create(cs, decl, locator);
assert(choice.isDecl());
return AllowInaccessibleMember::create(cs, choice.getDecl(), locator);

case MemberLookupResult::UR_MutatingMemberOnRValue:
case MemberLookupResult::UR_MutatingGetterOnRValue:
Expand Down