@@ -177,7 +177,7 @@ func testGeneric2<T: AnyObject, U>(x: GenericObject<T>, y: U) async throws {
177177// CHECK-LABEL: sil {{.*}}@${{.*}}22testSlowServerFromMain
178178@MainActor
179179func testSlowServerFromMain( slowServer: SlowServer ) async throws {
180- // CHECK: hop_to_executor %6 : $MainActor
180+ // CHECK: hop_to_executor {{%.*}} : $MainActor
181181 // CHECK: [[RESUME_BUF:%.*]] = alloc_stack $Int
182182 // CHECK: [[STRINGINIT:%.*]] = function_ref @$sSS10FoundationE19_bridgeToObjectiveCSo8NSStringCyF :
183183 // CHECK: [[ARG:%.*]] = apply [[STRINGINIT]]
@@ -194,8 +194,8 @@ func testSlowServerFromMain(slowServer: SlowServer) async throws {
194194 // CHECK: destroy_value [[ARG]]
195195 // CHECK: await_async_continuation [[CONT]] {{.*}}, resume [[RESUME:bb[0-9]+]]
196196 // CHECK: [[RESUME]]:
197+ // CHECK: hop_to_executor {{%.*}} : $MainActor
197198 // CHECK: [[RESULT:%.*]] = load [trivial] [[RESUME_BUF]]
198- // CHECK: hop_to_executor %6 : $MainActor
199199 // CHECK: fix_lifetime [[COPY]]
200200 // CHECK: destroy_value [[COPY]]
201201 // CHECK: dealloc_stack [[RESUME_BUF]]
@@ -223,8 +223,8 @@ func testThrowingMethodFromMain(slowServer: SlowServer) async -> String {
223223// CHECK: await_async_continuation [[RAW_CONT]] : $Builtin.RawUnsafeContinuation, resume [[RESUME:bb[0-9]+]], error [[ERROR:bb[0-9]+]]
224224
225225// CHECK: [[RESUME]]
226- // CHECK: {{.*}} = load [take] [[RESULT_BUF]] : $*String
227226// CHECK: hop_to_executor {{%.*}} : $MainActor
227+ // CHECK: {{.*}} = load [take] [[RESULT_BUF]] : $*String
228228// CHECK: fix_lifetime [[STRING_ARG_COPY]] : $NSString
229229// CHECK: destroy_value [[STRING_ARG_COPY]] : $NSString
230230// CHECK: dealloc_stack [[RESULT_BUF]] : $*String
@@ -241,3 +241,38 @@ func testThrowingMethodFromMain(slowServer: SlowServer) async -> String {
241241 return " none "
242242 }
243243}
244+
245+ // rdar://91502776
246+ // CHECK-LABEL: sil hidden [ossa] @$s{{.*}}21checkCostcoMembershipSbyYaF : $@convention(thin) @async () -> Bool {
247+ // CHECK: bb0:
248+ // CHECK: hop_to_executor {{%.*}} : $Optional<Builtin.Executor>
249+ // CHECK: [[FINAL_BUF:%.*]] = alloc_stack $Bool
250+ // CHECK: [[RESULT_BUF:%.*]] = alloc_stack $NSObject
251+ // CHECK: [[METH:%.*]] = objc_method {{%.*}} : $@objc_metatype Person.Type, #Person.asCustomer!foreign
252+ // CHECK: get_async_continuation_addr NSObject, [[RESULT_BUF]] : $*NSObject
253+ // CHECK: = apply [[METH]]
254+ // CHECK: dealloc_stack {{%.*}} : $*@block_storage
255+ // CHECK: await_async_continuation {{%.*}} : $Builtin.RawUnsafeContinuation, resume bb1
256+ // CHECK: bb1:
257+ // CHECK: hop_to_executor {{%.*}} : $Optional<Builtin.Executor>
258+ // CHECK: [[RESULT:%.*]] = load [take] [[RESULT_BUF]] : $*NSObject
259+ // CHECK: objc_method {{%.*}} : $CostcoManager, #CostcoManager.isCustomerEnrolled!foreign
260+ // CHECK: get_async_continuation_addr Bool, [[FINAL_BUF]] : $*Bool
261+ // CHECK: [[BLOCK_ARG:%.*]] = init_block_storage_header [[BLOCK_STORAGE:%.*]] : $*@block_storage
262+ // CHECK: = apply {{%.*}}([[RESULT]], [[BLOCK_ARG]], [[MANAGER:%.*]]) : $@convention(objc_method)
263+ // CHECK: [[EXTEND1:%.*]] = copy_value [[RESULT]] : $NSObject
264+ // CHECK: [[EXTEND2:%.*]] = copy_value [[MANAGER]] : $CostcoManager
265+ // CHECK: dealloc_stack [[BLOCK_STORAGE]] : $*@block_storage
266+ // CHECK: await_async_continuation {{%.*}} : $Builtin.RawUnsafeContinuation, resume bb2
267+ // CHECK: bb2:
268+ // CHECK: hop_to_executor {{%.*}} : $Optional<Builtin.Executor>
269+ // CHECK: [[ANSWER:%.*]] = load [trivial] [[FINAL_BUF]] : $*Bool
270+ // CHECK: fix_lifetime [[EXTEND2]] : $CostcoManager
271+ // CHECK: destroy_value [[EXTEND2]] : $CostcoManager
272+ // CHECK: fix_lifetime [[EXTEND1]] : $NSObject
273+ // CHECK: destroy_value [[EXTEND1]] : $NSObject
274+ // CHECK: return [[ANSWER]] : $Bool
275+ // CHECK: }
276+ func checkCostcoMembership( ) async -> Bool {
277+ return await CostcoManager . shared ( ) . isCustomerEnrolled ( inExecutiveProgram: Person . asCustomer ( ) )
278+ }
0 commit comments