Skip to content

Commit 43d793b

Browse files
committed
GenericSpecializer: fix a bug which prevented specialization for typealiases in some cases
Need to canonicalize the replacement type. Otherwise it could be generic if it is a typealias inside a generic type, e.g. ``` struct S<T> { typealias I = Int } ```
1 parent 8e874cd commit 43d793b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/SILOptimizer/Utils/Generics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ bool ReabstractionInfo::prepareAndCheck(ApplySite Apply, SILFunction *Callee,
601601

602602
// Check only the substitutions for the generic parameters.
603603
// Ignore any dependent types, etc.
604-
auto Replacement = Type(GP).subst(CalleeParamSubMap);
604+
auto Replacement = Type(GP).subst(CalleeParamSubMap)->getCanonicalType();
605605
if (!Replacement->is<ArchetypeType>())
606606
HasNonArchetypeGenericParams = true;
607607

0 commit comments

Comments
 (0)