Sema: Fold TypeAliasDecl::computeType() into validateDecl()

This commit is contained in:
Slava Pestov
2019-10-10 02:12:21 -04:00
parent 797a7974bc
commit 6974448b1e
8 changed files with 13 additions and 35 deletions

View File

@@ -3546,25 +3546,6 @@ SourceRange TypeAliasDecl::getSourceRange() const {
return { TypeAliasLoc, getNameLoc() };
}
void TypeAliasDecl::computeType() {
assert(!hasInterfaceType());
// Set the interface type of this declaration.
ASTContext &ctx = getASTContext();
auto genericSig = getGenericSignature();
SubstitutionMap subs;
if (genericSig)
subs = genericSig->getIdentitySubstitutionMap();
Type parent;
auto parentDC = getDeclContext();
if (parentDC->isTypeContext())
parent = parentDC->getSelfInterfaceType();
auto sugaredType = TypeAliasType::get(this, parent, subs, getUnderlyingType());
setInterfaceType(MetatypeType::get(sugaredType, ctx));
}
Type TypeAliasDecl::getUnderlyingType() const {
auto &ctx = getASTContext();
return evaluateOrDefault(ctx.evaluator,