Skip to content

Commit 4f42c55

Browse files
committed
AST: Fix two problems in SubstitutionMap::get(GenericSignature, SubstitutionMap)
It's fine to have the empty generic signature and non-empty substitution map here. Also, correctly handle an input generic signature with non-canonical generic parameter types.
1 parent 76d9154 commit 4f42c55

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/AST/SubstitutionMap.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,13 @@ SubstitutionMap SubstitutionMap::getCanonical(bool canonicalizeSignature) const
192192

193193
SubstitutionMap SubstitutionMap::get(GenericSignature genericSig,
194194
SubstitutionMap substitutions) {
195-
if (!genericSig) {
196-
assert(!substitutions.hasAnySubstitutableParams() &&
197-
"Shouldn't have substitutions here");
195+
if (!genericSig)
198196
return SubstitutionMap();
199-
}
200197

201198
return SubstitutionMap::get(genericSig,
202199
[&](SubstitutableType *type) -> Type {
203200
return substitutions.lookupSubstitution(
204-
CanSubstitutableType(type));
201+
cast<SubstitutableType>(type->getCanonicalType()));
205202
},
206203
LookUpConformanceInSubstitutionMap(substitutions));
207204
}

0 commit comments

Comments
 (0)