Skip to content

Commit f161fa1

Browse files
committed
[Test] FC'd part_ap of async dyn witness_method.
1 parent 0e3ec87 commit f161fa1

File tree

1 file changed

+70
-4
lines changed

1 file changed

+70
-4
lines changed

test/IRGen/async/run-partialapply-capture-generic_conformer-and-generic-to-void.sil

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// RUN: %target-build-swift-dylib(%t/%target-library-name(PrintShims)) %S/../../Inputs/print-shims.swift -module-name PrintShims -emit-module -emit-module-path %t/PrintShims.swiftmodule
33
// RUN: %target-codesign %t/%target-library-name(PrintShims)
44
// RUN: %target-build-swift -Xfrontend -enable-experimental-concurrency -g -parse-sil %s -emit-ir -I %t -L %t -lPrintShim | %FileCheck %s --check-prefix=CHECK-LL
5+
// RUN: %target-sil-opt -sil-inline-generics -enable-sil-verify-all -inline -partial-apply-lowering %s | %FileCheck %s --check-prefix=CHECK-SIL
56
// RUN: %target-build-swift -Xfrontend -enable-experimental-concurrency -g -parse-sil %s -module-name main -o %t/main -I %t -L %t -lPrintShims %target-rpath(%t)
67
// RUN: %target-codesign %t/main
78
// RUN: %target-run %t/main %t/%target-library-name(PrintShims) | %FileCheck %s
@@ -13,7 +14,6 @@
1314

1415
import Builtin
1516
import Swift
16-
import PrintShims
1717
import _Concurrency
1818

1919
sil public_external @printGeneric : $@convention(thin) <T> (@in_guaranteed T) -> ()
@@ -55,12 +55,78 @@ sil_witness_table ObserverImpl : Observer module main {
5555
associated_type Result : ()
5656
}
5757

58+
// CHECK-SIL-LABEL: sil hidden @witness_method
59+
// CHECK-SIL-SAME: : $@convention(thin) @async
60+
// CHECK-SIL-SAME: <S where S : Observable>
61+
// CHECK-SIL-SAME: <O where O : Observer, S.Result == O.Result>
62+
// CHECK-SIL-SAME: (@in S) -> @owned @async @callee_guaranteed (@in O) -> () {
63+
// CHECK-SIL: bb0([[S_INSTANCE:%[^,]+]] : $*S):
64+
// CHECK-SIL: [[WITNESS_METHOD:%[^,]+]] = witness_method $S, #Observable.subscribe
65+
// CHECK-SIL-SAME: : <Self where Self : Observable><T where T : Observer> (Self) -> (T) async -> ()
66+
// CHECK-SIL-SAME: : $@convention(witness_method: Observable) @async
67+
// CHECK-SIL-SAME: <τ_0_0 where τ_0_0 : Observable>
68+
// CHECK-SIL-SAME: <τ_1_0 where τ_1_0 : Observer, τ_0_0.Result == τ_1_0.Result>
69+
// CHECK-SIL-SAME: (@in τ_1_0, @in_guaranteed τ_0_0) -> ()
70+
// CHECK-SIL: [[THUNK:%[^,]+]] = function_ref @$s14witness_methodTw
71+
// CHECK-SIL-SAME: : $@convention(thin) @async
72+
// CHECK-SIL-SAME: <τ_0_0 where τ_0_0 : Observable>
73+
// CHECK-SIL-SAME: <τ_1_0 where τ_1_0 : Observer, τ_0_0.Result == τ_1_0.Result>
74+
// CHECK-SIL-SAME: (
75+
// CHECK-SIL-SAME: @in τ_1_0,
76+
// CHECK-SIL-SAME: @in_guaranteed τ_0_0,
77+
// CHECK-SIL-SAME: @convention(witness_method: Observable) @async
78+
// CHECK-SIL-SAME: <τ_0_0 where τ_0_0 : Observable>
79+
// CHECK-SIL-SAME: <τ_1_0 where τ_1_0 : Observer, τ_0_0.Result == τ_1_0.Result>
80+
// CHECK-SIL-SAME: (@in τ_1_0, @in_guaranteed τ_0_0) -> ()
81+
// CHECK-SIL-SAME: ) -> ()
82+
// CHECK-SIL: [[RESULT:%[^,]+]] = partial_apply [callee_guaranteed] [[THUNK]]<S, O>([[S_INSTANCE]], [[WITNESS_METHOD]])
83+
// CHECK-SIL-SAME: : $@convention(thin) @async
84+
// CHECK-SIL-SAME: <τ_0_0 where τ_0_0 : Observable>
85+
// CHECK-SIL-SAME: <τ_1_0 where τ_1_0 : Observer, τ_0_0.Result == τ_1_0.Result>
86+
// CHECK-SIL-SAME: (
87+
// CHECK-SIL-SAME: @in τ_1_0,
88+
// CHECK-SIL-SAME: @in_guaranteed τ_0_0,
89+
// CHECK-SIL-SAME: @convention(witness_method: Observable) @async
90+
// CHECK-SIL-SAME: <τ_0_0 where τ_0_0 : Observable>
91+
// CHECK-SIL-SAME: <τ_1_0 where τ_1_0 : Observer, τ_0_0.Result == τ_1_0.Result>
92+
// CHECK-SIL-SAME: (@in τ_1_0, @in_guaranteed τ_0_0) -> ()
93+
// CHECK-SIL-SAME: ) -> ()
94+
// CHECK-SIL: return [[RESULT]] : $@async @callee_guaranteed (@in O) -> ()
95+
// CHECK-SIL-LABEL: } // end sil function 'witness_method'
96+
97+
// CHECK-SIL-LABEL: sil private [thunk] [ossa] @$s14witness_methodTw
98+
// CHECK-SIL-SAME: : $@convention(thin) @async
99+
// CHECK-SIL-SAME: <S where S : Observable>
100+
// CHECK-SIL-SAME: <O where O : Observer, S.Result == O.Result>
101+
// CHECK-SIL-SAME: (
102+
// CHECK-SIL-SAME: @in O,
103+
// CHECK-SIL-SAME: @in_guaranteed S,
104+
// CHECK-SIL-SAME: @convention(witness_method: Observable) @async
105+
// CHECK-SIL-SAME: <S where S : Observable>
106+
// CHECK-SIL-SAME: <O where O : Observer, S.Result == O.Result>
107+
// CHECK-SIL-SAME: (@in O, @in_guaranteed S) -> ()
108+
// CHECK-SIL-SAME: ) -> () {
109+
// CHECK-SIL: bb0(
110+
// CHECK-SIL-SAME: [[O_INSTANCE:%[^,]+]] : $*O,
111+
// CHECK-SIL-SAME: [[S_INSTANCE:%[^,]+]] : $*S,
112+
// CHECK-SIL-SAME: [[WITNESS_METHOD:%[^,]+]] : $
113+
// CHECK-SIL-SAME: @convention(witness_method: Observable) @async
114+
// CHECK-SIL-SAME: <τ_0_0 where τ_0_0 : Observable><τ_1_0 where τ_1_0 : Observer, τ_0_0.Result == τ_1_0.Result>
115+
// CHECK-SIL-SAME: (@in τ_1_0, @in_guaranteed τ_0_0) -> ()
116+
// CHECK-SIL-SAME: ):
117+
// CHECK-SIL: [[RESULT:%[^,]+]] = apply [[WITNESS_METHOD]]<S, O>(
118+
// CHECK-SIL-SAME: [[O_INSTANCE]],
119+
// CHECK-SIL-SAME: [[S_INSTANCE]]
120+
// CHECK-SIL-SAME: ) : $@convention(witness_method: Observable) @async <τ_0_0 where τ_0_0 : Observable><τ_1_0 where τ_1_0 : Observer, τ_0_0.Result == τ_1_0.Result> (@in τ_1_0, @in_guaranteed τ_0_0) -> ()
121+
// CHECK-SIL: return [[RESULT]] : $()
122+
// CHECK-SIL-LABEL: } // end sil function '$s14witness_methodTw'
123+
58124
// CHECK-LL: define internal swift{{(tail)?}}cc void @"$s14witness_methodTwTA"(%swift.task* {{%[0-9]+}}, %swift.executor* {{%[0-9]+}}, %swift.context* swiftasync {{%[0-9]+}}) {{#[0-9]*}}
59-
sil hidden @witness_method : $@async @convention(thin) <S where S : Observable><O where O : Observer, S.Result == O.Result> (@in S) -> @owned @async @callee_owned (@in O) -> () {
125+
sil hidden @witness_method : $@async @convention(thin) <S where S : Observable><O where O : Observer, S.Result == O.Result> (@in S) -> @owned @async @callee_guaranteed (@in O) -> () {
60126
bb0(%0 : $*S):
61127
%1 = witness_method $S, #Observable.subscribe : $@async @convention(witness_method: Observable) <τ_0_0 where τ_0_0 : Observable><τ_1_0 where τ_1_0 : Observer, τ_0_0.Result == τ_1_0.Result> (@in τ_1_0, @in_guaranteed τ_0_0) -> ()
62-
%2 = partial_apply %1<S, O>(%0) : $@async @convention(witness_method: Observable) <τ_0_0 where τ_0_0 : Observable><τ_1_0 where τ_1_0 : Observer, τ_0_0.Result == τ_1_0.Result> (@in τ_1_0, @in_guaranteed τ_0_0) -> ()
63-
return %2 : $@async @callee_owned (@in O) -> ()
128+
%2 = partial_apply [callee_guaranteed] %1<S, O>(%0) : $@async @convention(witness_method: Observable) <τ_0_0 where τ_0_0 : Observable><τ_1_0 where τ_1_0 : Observer, τ_0_0.Result == τ_1_0.Result> (@in τ_1_0, @in_guaranteed τ_0_0) -> ()
129+
return %2 : $@async @callee_guaranteed (@in O) -> ()
64130
}
65131

66132

0 commit comments

Comments
 (0)