mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: Fix diagnostics when 'self' in a convenience init has DynamicSelfType
We don't want to print 'Self' here; the actual concrete type is more useful. NFC for now, but becomes important once a subsequent patch gives 'self' a DynamicSelfType in convenience initializers.
This commit is contained in:
@@ -1540,8 +1540,8 @@ void CalleeCandidateInfo::collectCalleeCandidates(Expr *fn,
|
||||
auto decl = declRefExpr->getDecl();
|
||||
candidates.push_back({ decl, getCalleeLevel(decl) });
|
||||
|
||||
if (auto fTy = decl->getInterfaceType()->getAs<AnyFunctionType>())
|
||||
declName = fTy->getInput()->getRValueInstanceType()->getString()+".init";
|
||||
if (auto selfTy = decl->getDeclContext()->getSelfInterfaceType())
|
||||
declName = selfTy.getString() + ".init";
|
||||
else
|
||||
declName = "init";
|
||||
return;
|
||||
@@ -1657,7 +1657,7 @@ void CalleeCandidateInfo::collectCalleeCandidates(Expr *fn,
|
||||
if (UDE->getName().getBaseName() == CS.TC.Context.Id_init) {
|
||||
auto selfTy = CS.getType(UDE->getBase())->getWithoutSpecifierType();
|
||||
if (!selfTy->hasTypeVariable())
|
||||
declName = selfTy.getString() + "." + declName;
|
||||
declName = selfTy->eraseDynamicSelfType().getString() + "." + declName;
|
||||
}
|
||||
|
||||
// Otherwise, look for a disjunction constraint explaining what the set is.
|
||||
|
||||
Reference in New Issue
Block a user