Give opened archetypes a generic environment.

And maybe allow nested types to live on them.
This commit is contained in:
Joe Groff
2019-01-07 16:03:27 -08:00
parent 345e9881d1
commit 0cfca9496a
16 changed files with 105 additions and 41 deletions

View File

@@ -3822,9 +3822,10 @@ void Serializer::writeType(Type ty) {
case TypeKind::PrimaryArchetype:
case TypeKind::NestedArchetype: {
auto archetypeTy = cast<ArchetypeType>(ty.getPointer());
assert(isa<PrimaryArchetypeType>(archetypeTy->getRoot())
&& "need to implement for nested archetypes of opened/opaque types");
auto env = archetypeTy->getPrimary()->getGenericEnvironment();
assert(env && "Primary archetype without generic environment?");
auto env = archetypeTy->getGenericEnvironment();
GenericEnvironmentID envID = addGenericEnvironmentRef(env);
Type interfaceType = archetypeTy->getInterfaceType();