Skip to content

Commit 4eb3163

Browse files
authored
Merge pull request #27202 from jckarter/opaque-type-fallback-fix
IRGen: Use correct generic sig when mangling opaque underlying type.
2 parents 73871aa + 30f5269 commit 4eb3163

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/IRGen/GenMeta.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,14 +1683,16 @@ namespace {
16831683
}
16841684

16851685
void addUnderlyingTypeAndConformances() {
1686-
auto sig = O->getOpaqueInterfaceGenericSignature()
1687-
? O->getOpaqueInterfaceGenericSignature()->getCanonicalSignature()
1688-
: CanGenericSignature();
1686+
auto sig = O->getOpaqueInterfaceGenericSignature();
16891687
auto underlyingType = Type(O->getUnderlyingInterfaceType())
16901688
.subst(*O->getUnderlyingTypeSubstitutions())
16911689
->getCanonicalType(sig);
1690+
1691+
auto contextSig = O->getGenericSignature()
1692+
? O->getGenericSignature()->getCanonicalSignature()
1693+
: CanGenericSignature();
16921694

1693-
B.addRelativeAddress(IGM.getTypeRef(underlyingType, sig,
1695+
B.addRelativeAddress(IGM.getTypeRef(underlyingType, contextSig,
16941696
MangledTypeRefRole::Metadata).first);
16951697

16961698
auto opaqueType = O->getDeclaredInterfaceType()
@@ -1704,7 +1706,7 @@ namespace {
17041706

17051707
auto witnessTableRef = IGM.emitWitnessTableRefString(
17061708
underlyingType, underlyingConformance,
1707-
O->getGenericSignature(),
1709+
contextSig,
17081710
/*setLowBit*/ false);
17091711
B.addRelativeAddress(witnessTableRef);
17101712
}

0 commit comments

Comments
 (0)