Skip to content

Commit c55f54d

Browse files
committed
GenericEnvironment: Allow 'mapTypeIntoContext' to accept types containing opened archetypes
1 parent 3c17d35 commit c55f54d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/AST/GenericEnvironment.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ Optional<Type> GenericEnvironment::getMappingIfPresent(
8686

8787
Type GenericEnvironment::mapTypeIntoContext(GenericEnvironment *env,
8888
Type type) {
89-
assert(!type->hasArchetype() && "already have a contextual type");
89+
assert((!type->hasArchetype() || type->hasOpenedExistential()) &&
90+
"already have a contextual type");
9091
assert((env || !type->hasTypeParameter()) &&
9192
"no generic environment provided for type with type parameters");
9293

@@ -230,8 +231,8 @@ Type QueryInterfaceTypeSubstitutions::operator()(SubstitutableType *type) const{
230231
Type GenericEnvironment::mapTypeIntoContext(
231232
Type type,
232233
LookupConformanceFn lookupConformance) const {
233-
assert(!type->hasOpenedExistential() &&
234-
"Opened existentials are special and so are you");
234+
assert((!type->hasArchetype() || type->hasOpenedExistential()) &&
235+
"already have a contextual type");
235236

236237
Type result = type.subst(QueryInterfaceTypeSubstitutions(this),
237238
lookupConformance,

0 commit comments

Comments
 (0)