Skip to content

Commit 4093d5e

Browse files
committed
SILOptimizer: Fix isPartialApplyOfReabstractionThunk() for thunks capturing DynamicSelfType
If a thunk's type involves DynamicSelfType, a second value must be captured of metatype type.
1 parent a5675a8 commit 4093d5e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/SIL/InstructionUtils.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,10 @@ bool swift::isSanitizerInstrumentation(SILInstruction *Instruction) {
352352
}
353353

354354
SILValue swift::isPartialApplyOfReabstractionThunk(PartialApplyInst *PAI) {
355-
if (PAI->getNumArguments() != 1)
355+
// A partial_apply of a reabstraction thunk either has a single capture
356+
// (a function) or two captures (function and dynamic Self type).
357+
if (PAI->getNumArguments() != 1 &&
358+
PAI->getNumArguments() != 2)
356359
return SILValue();
357360

358361
auto *Fun = PAI->getReferencedFunction();

0 commit comments

Comments
 (0)