|
| 1 | +// RUN: %target-swift-emit-silgen -parse-as-library %s | %FileCheck %s |
| 2 | + |
| 3 | +enum PartialApplyEnumPayload<T, U> { |
| 4 | + case Left(T) |
| 5 | + case Both(T, U) |
| 6 | + |
| 7 | + case LeftWithLabel(left: T) |
| 8 | + case BothWithLabel(left: T, right: U) |
| 9 | + |
| 10 | + case TupleWithLabel(both: (T, U)) |
| 11 | + |
| 12 | + // Note: SILGen can emit these thunks correctly, but we disabled |
| 13 | + // the feature since calling the constructor directly (without a |
| 14 | + // thunk) doesn't work yet. |
| 15 | + /* case Variadic(_: Int...) |
| 16 | + case VariadicWithLabel(indices: Int...) |
| 17 | + case VariadicTuple(_: (Int, Int)...) |
| 18 | + case VariadicWithOther(String, _: Int...) */ |
| 19 | + |
| 20 | + case Autoclosure(@autoclosure () -> ()) |
| 21 | +} |
| 22 | + |
| 23 | +struct S {} |
| 24 | +struct C {} |
| 25 | + |
| 26 | +func partialApplyEnumCases(_ x: S, y: C) { |
| 27 | + _ = PartialApplyEnumPayload<S, C>.Left |
| 28 | + _ = PartialApplyEnumPayload<S, C>.Both |
| 29 | + _ = PartialApplyEnumPayload<S, C>.LeftWithLabel |
| 30 | + _ = PartialApplyEnumPayload<S, C>.TupleWithLabel |
| 31 | + /* _ = PartialApplyEnumPayload<S, C>.Variadic |
| 32 | + _ = PartialApplyEnumPayload<S, C>.VariadicWithLabel |
| 33 | + _ = PartialApplyEnumPayload<S, C>.VariadicTuple |
| 34 | + _ = PartialApplyEnumPayload<S, C>.VariadicWithOther */ |
| 35 | + _ = PartialApplyEnumPayload<S, C>.Autoclosure |
| 36 | +} |
| 37 | + |
| 38 | +// CHECK-LABEL: sil shared [transparent] [thunk] [ossa] @$s17enum_curry_thunks23PartialApplyEnumPayloadO4LeftyACyxq_GxcAEmr0_lFTc : $@convention(thin) <T, U> (@thin PartialApplyEnumPayload<T, U>.Type) -> @owned @callee_guaranteed (@in_guaranteed T) -> @out PartialApplyEnumPayload<T, U> { |
| 39 | +// CHECK-LABEL: sil shared [transparent] [ossa] @$s17enum_curry_thunks23PartialApplyEnumPayloadO4LeftyACyxq_GxcAEmr0_lF : $@convention(method) <T, U> (@in T, @thin PartialApplyEnumPayload<T, U>.Type) -> @out PartialApplyEnumPayload<T, U> { |
| 40 | + |
| 41 | +// CHECK-LABEL: sil shared [transparent] [thunk] [ossa] @$s17enum_curry_thunks23PartialApplyEnumPayloadO4BothyACyxq_Gx_q_tcAEmr0_lFTc : $@convention(thin) <T, U> (@thin PartialApplyEnumPayload<T, U>.Type) -> @owned @callee_guaranteed (@in_guaranteed T, @in_guaranteed U) -> @out PartialApplyEnumPayload<T, U> { |
| 42 | +// CHECK-LABEL: sil shared [transparent] [ossa] @$s17enum_curry_thunks23PartialApplyEnumPayloadO4BothyACyxq_Gx_q_tcAEmr0_lF : $@convention(method) <T, U> (@in T, @in U, @thin PartialApplyEnumPayload<T, U>.Type) -> @out PartialApplyEnumPayload<T, U> { |
| 43 | + |
| 44 | +// CHECK-LABEL: sil shared [transparent] [thunk] [ossa] @$s17enum_curry_thunks23PartialApplyEnumPayloadO13LeftWithLabelyACyxq_Gx_tcAEmr0_lFTc : $@convention(thin) <T, U> (@thin PartialApplyEnumPayload<T, U>.Type) -> @owned @callee_guaranteed (@in_guaranteed T) -> @out PartialApplyEnumPayload<T, U> { |
| 45 | +// CHECK-LABEL: sil shared [transparent] [ossa] @$s17enum_curry_thunks23PartialApplyEnumPayloadO13LeftWithLabelyACyxq_Gx_tcAEmr0_lF : $@convention(method) <T, U> (@in T, @thin PartialApplyEnumPayload<T, U>.Type) -> @out PartialApplyEnumPayload<T, U> { |
| 46 | + |
| 47 | +// CHECK-LABEL: sil shared [transparent] [thunk] [ossa] @$s17enum_curry_thunks23PartialApplyEnumPayloadO14TupleWithLabelyACyxq_Gx_q_t_tcAEmr0_lFTc : $@convention(thin) <T, U> (@thin PartialApplyEnumPayload<T, U>.Type) -> @owned @callee_guaranteed (@in_guaranteed T, @in_guaranteed U) -> @out PartialApplyEnumPayload<T, U> { |
| 48 | +// CHECK-LABEL: sil shared [transparent] [ossa] @$s17enum_curry_thunks23PartialApplyEnumPayloadO14TupleWithLabelyACyxq_Gx_q_t_tcAEmr0_lF : $@convention(method) <T, U> (@in T, @in U, @thin PartialApplyEnumPayload<T, U>.Type) -> @out PartialApplyEnumPayload<T, U> { |
| 49 | + |
| 50 | +// CHECK-LABEL: sil shared [transparent] [thunk] [ossa] @$s17enum_curry_thunks23PartialApplyEnumPayloadO11AutoclosureyACyxq_GyyXAcAEmr0_lFTc : $@convention(thin) <T, U> (@thin PartialApplyEnumPayload<T, U>.Type) -> @owned @callee_guaranteed (@guaranteed @callee_guaranteed () -> ()) -> @out PartialApplyEnumPayload<T, U> { |
| 51 | +// CHECK-LABEL: sil shared [transparent] [ossa] @$s17enum_curry_thunks23PartialApplyEnumPayloadO11AutoclosureyACyxq_GyyXAcAEmr0_lF : $@convention(method) <T, U> (@owned @callee_guaranteed () -> (), @thin PartialApplyEnumPayload<T, U>.Type) -> @out PartialApplyEnumPayload<T, U> { |
0 commit comments