AST: Remove TypeDecl::getDeclaredType()

A pointless use of polymorphism -- the result values are not
interchangeable in any practical sense:

- For GenericTypeParamDecls, this returned getDeclaredInterfaceType(),
  which is an interface type.

- For AssociatedTypeDecls, this returned the sugared AssociatedTypeType,
  which desugars to an archetype.

- For TypeAliasDecls, this returned TypeAliasDecl::getAliasType(),
  which desugars to a type containing archetypes.

- For NominalTypeDecls, this returned NominalTypeDecl::getDeclaredType(),
  which is the unbound generic type, a special case used for inferring
  generic arguments when they're not written in source.
This commit is contained in:
Slava Pestov
2016-11-29 22:24:04 -08:00
parent 8bdbe774e0
commit 2d83a79c2c
26 changed files with 97 additions and 98 deletions

View File

@@ -518,9 +518,9 @@ void SILGenFunction::emitArtificialTopLevel(ClassDecl *mainClass) {
// we're getting away with it because the types are guaranteed to already
// be imported.
ASTContext &ctx = getASTContext();
Module *UIKit = ctx.getLoadedModule(ctx.getIdentifier("UIKit"));
DeclContext *UIKit = ctx.getLoadedModule(ctx.getIdentifier("UIKit"));
SmallVector<ValueDecl *, 1> results;
UIKit->lookupQualified(UIKit->getDeclaredType(),
UIKit->lookupQualified(UIKit->getDeclaredInterfaceType(),
ctx.getIdentifier("UIApplicationMain"),
NL_QualifiedDefault,
/*resolver*/nullptr,