Skip to content

Commit 8bb3248

Browse files
committed
SIL: TypeSubstCloner::remapASTType() should not call getLoweredRValueType()
SILCloner::visitScalarPackIndexInst() was calling remapASTType() on a PackType. This was becoming a SILPackType, which would then crash in a cast<>.
1 parent 0d1e507 commit 8bb3248

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/swift/SIL/TypeSubstCloner.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,10 @@ class TypeSubstCloner : public SILClonerWithScopes<ImplClass> {
187187
.shouldLookThroughOpaqueTypeArchetypes())
188188
return substTy;
189189
// Remap types containing opaque result types in the current context.
190-
return getBuilder().getModule().Types.getLoweredRValueType(
191-
TypeExpansionContext(getBuilder().getFunction()), substTy);
190+
return substOpaqueTypesWithUnderlyingTypes(
191+
substTy,
192+
TypeExpansionContext(getBuilder().getFunction()),
193+
/*allowLoweredTypes=*/false);
192194
}
193195

194196
ProtocolConformanceRef remapConformance(Type ty,

0 commit comments

Comments
 (0)