Merge pull request #15497 from DougGregor/remove-name-alias-type

[AST] Fully replace NameAliasType with the new, sugary-sweet BoundNameAliasType
This commit is contained in:
Doug Gregor
2018-03-26 09:03:03 -07:00
committed by GitHub
49 changed files with 1381 additions and 1367 deletions

View File

@@ -2731,10 +2731,22 @@ public:
Builder.addTextChunk(TAD->getName().str());
if (TAD->hasInterfaceType()) {
auto underlyingType = TAD->getUnderlyingTypeLoc().getType();
if (underlyingType->hasError())
addTypeAnnotation(Builder, TAD->getDeclaredInterfaceType());
else
if (underlyingType->hasError()) {
Type parentType;
if (auto nominal =
TAD->getDeclContext()
->getAsNominalTypeOrNominalTypeExtensionContext()) {
parentType = nominal->getDeclaredInterfaceType();
}
addTypeAnnotation(
Builder,
NameAliasType::get(const_cast<TypeAliasDecl *>(TAD),
parentType, SubstitutionMap(),
underlyingType));
} else {
addTypeAnnotation(Builder, underlyingType);
}
}
}
@@ -2927,9 +2939,9 @@ public:
Optional<Type> Result = None;
if (auto AT = MT->getInstanceType()) {
if (!CD->getInterfaceType()->is<ErrorType>() &&
isa<NameAliasType>(AT.getPointer()) &&
AT->getDesugaredType() ==
CD->getResultInterfaceType().getPointer())
(isa<NameAliasType>(AT.getPointer()) &&
AT->getDesugaredType() ==
CD->getResultInterfaceType().getPointer()))
Result = AT;
}
addConstructorCall(CD, Reason, None, Result);