mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user