Skip to content

Commit 06f5218

Browse files
committed
Add negative test for SR-12548.
Test SR-12548: `SILCombiner::visitPartialApplyInst` rewrites `partial_apply` with `@convention(method)` callee to `thin_to_thick_function`. This produces a SIL verification error: `thin_to_thick_function` only supports `@convention(thin)` operands.
1 parent 1c64770 commit 06f5218

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// RUN: not %target-build-swift -O %s
2+
3+
// SR-12548: SIL verification error regarding
4+
// `CapturePropagation::rewritePartialApply` for `partial_apply` with
5+
// `@convention(method)` callee.
6+
7+
import _Differentiation
8+
9+
protocol Protocol: Differentiable {
10+
@differentiable
11+
func method() -> Self
12+
}
13+
14+
extension Protocol {
15+
@differentiable
16+
func method() -> Self { self }
17+
}
18+
19+
struct Struct: Protocol {}
20+
21+
let _: @differentiable (Struct) -> Struct = { $0.method() }
22+
23+
// SIL verification failed: operand of thin_to_thick_function must be thin: opFTy->getRepresentation() == SILFunctionType::Representation::Thin
24+
// Verifying instruction:
25+
// // function_ref specialized Protocol.method()
26+
// %5 = function_ref @$s7crasher8ProtocolPAAE6methodxyFAA6StructV_TG5 : $@convention(method) (@in_guaranteed Struct) -> @out Struct // user: %6
27+
// -> %6 = thin_to_thick_function %5 : $@convention(method) (@in_guaranteed Struct) -> @out Struct to $@callee_guaranteed (@in_guaranteed Struct) -> @out Struct // user: %11

0 commit comments

Comments
 (0)