mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CSSimplify] Fix unviable "instance member on metatype" choice
Adjust base type and reference kind so it looks as-if it is a correct reference when used by constraint system.
This commit is contained in:
@@ -3753,8 +3753,15 @@ performMemberLookup(ConstraintKind constraintKind, DeclName memberName,
|
||||
if (decl->isInstanceMember()) {
|
||||
if ((isa<FuncDecl>(decl) && !hasInstanceMethods) ||
|
||||
(!isa<FuncDecl>(decl) && !hasInstanceMembers)) {
|
||||
result.addUnviable(candidate,
|
||||
MemberLookupResult::UR_InstanceMemberOnType);
|
||||
// `AnyObject` has special semantics, so let's just let it be.
|
||||
// Otherwise adjust base type and reference kind to make it
|
||||
// look as if lookup was done on the instance, that helps
|
||||
// with diagnostics.
|
||||
auto choice = instanceTy->isAnyObject()
|
||||
? candidate
|
||||
: OverloadChoice(instanceTy, decl,
|
||||
FunctionRefKind::SingleApply);
|
||||
result.addUnviable(choice, MemberLookupResult::UR_InstanceMemberOnType);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user