Skip to content

Commit cd27a29

Browse files
authored
Merge pull request #23997 from xedin/allow-attaching-fixes-to-members-without-decl
[ConstraintSystem] Overload choice should not be required to refer to…
2 parents 7c31892 + 374a10c commit cd27a29

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4243,13 +4243,13 @@ fixMemberRef(ConstraintSystem &cs, Type baseTy,
42434243
DeclName memberName, const OverloadChoice &choice,
42444244
ConstraintLocator *locator,
42454245
Optional<MemberLookupResult::UnviableReason> reason = None) {
4246-
if (!choice.isDecl())
4247-
return nullptr;
4248-
4249-
auto *decl = choice.getDecl();
4250-
if (auto *CD = dyn_cast<ConstructorDecl>(decl)) {
4251-
if (auto *fix = validateInitializerRef(cs, CD, locator))
4252-
return fix;
4246+
// Not all of the choices handled here are going
4247+
// to refer to a declaration.
4248+
if (choice.isDecl()) {
4249+
if (auto *CD = dyn_cast<ConstructorDecl>(choice.getDecl())) {
4250+
if (auto *fix = validateInitializerRef(cs, CD, locator))
4251+
return fix;
4252+
}
42534253
}
42544254

42554255
if (reason) {
@@ -4259,7 +4259,8 @@ fixMemberRef(ConstraintSystem &cs, Type baseTy,
42594259
return AllowTypeOrInstanceMember::create(cs, baseTy, memberName, locator);
42604260

42614261
case MemberLookupResult::UR_Inaccessible:
4262-
return AllowInaccessibleMember::create(cs, decl, locator);
4262+
assert(choice.isDecl());
4263+
return AllowInaccessibleMember::create(cs, choice.getDecl(), locator);
42634264

42644265
case MemberLookupResult::UR_MutatingMemberOnRValue:
42654266
case MemberLookupResult::UR_MutatingGetterOnRValue:

0 commit comments

Comments
 (0)