Skip to content

Commit e27e75f

Browse files
committed
SILGen: Use the correct GenericEnvironment when lowering functions with pack element captures
1 parent d7ad86a commit e27e75f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/SILGen/SILGen.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,8 +1223,10 @@ void SILGenModule::preEmitFunction(SILDeclRef constant, SILFunction *F,
12231223
SILLocation Loc) {
12241224
assert(F->empty() && "already emitted function?!");
12251225

1226-
if (F->getLoweredFunctionType()->isPolymorphic())
1227-
F->setGenericEnvironment(Types.getConstantGenericEnvironment(constant));
1226+
if (F->getLoweredFunctionType()->isPolymorphic()) {
1227+
auto pair = Types.getForwardingSubstitutionsForLowering(constant);
1228+
F->setGenericEnvironment(pair.first, pair.second);
1229+
}
12281230

12291231
// If we have global actor isolation for our constant, put the isolation onto
12301232
// the function.

0 commit comments

Comments
 (0)