Merge pull request #23997 from xedin/allow-attaching-fixes-to-members-without-decl

[ConstraintSystem] Overload choice should not be required to refer to…
This commit is contained in:
Pavel Yaskevich
2019-04-12 18:36:41 -07:00
committed by GitHub

View File

@@ -4243,13 +4243,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) {
@@ -4259,7 +4259,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: