Sema: Don't set type of AssociatedTypeDecl until we have an archetype

Otherwise the verifier can crash because hasType() returns true but
getType() gives us a MetatypeType that hits a null pointer in
desugaring.

The computeType() calls appear in a few too many places for my liking;
would be nice to clean this up further or replace everything with
interface types one day.

Fixes <rdar://problem/19606899>.

Swift SVN r30388
This commit is contained in:
Slava Pestov
2015-07-19 20:57:18 +00:00
parent 78bbcce84a
commit 6b7647c0a7
53 changed files with 76 additions and 54 deletions

View File

@@ -2155,6 +2155,7 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext) {
defaultDefinitionID);
declOrOffset = assocType;
assocType->computeType();
assocType->setAccessibility(cast<ProtocolDecl>(DC)->getFormalAccess());
assocType->setSuperclass(getType(superclassID));
assocType->setArchetype(getType(archetypeID)->castTo<ArchetypeType>());