|
1 |
| -// RUN: %target-swift-emit-silgen -module-name dynamic_lookup -enable-objc-interop -parse-as-library -disable-objc-attr-requires-foundation-module %s | %FileCheck %s |
2 |
| -// RUN: %target-swift-emit-silgen -module-name dynamic_lookup -enable-objc-interop -parse-as-library -disable-objc-attr-requires-foundation-module %s | %FileCheck %s --check-prefix=GUARANTEED |
| 1 | +// RUN: %target-swift-emit-silgen -module-name dynamic_lookup -enable-objc-interop -parse-as-library -disable-objc-attr-requires-foundation-module -disable-availability-checking %s | %FileCheck %s |
| 2 | +// RUN: %target-swift-emit-silgen -module-name dynamic_lookup -enable-objc-interop -parse-as-library -disable-objc-attr-requires-foundation-module -disable-availability-checking %s | %FileCheck %s --check-prefix=GUARANTEED |
| 3 | + |
| 4 | +// REQUIRES: objc_interop |
| 5 | +// REQUIRES: concurrency |
3 | 6 |
|
4 | 7 | class X {
|
5 | 8 | @objc func f() { }
|
@@ -405,3 +408,25 @@ func testAnyObjectWithDefault(_ x: AnyObject) {
|
405 | 408 | // CHECK: apply [[METHOD]]([[DEFARG]], [[OPENEDX]])
|
406 | 409 | x.hasDefaultParam()
|
407 | 410 | }
|
| 411 | + |
| 412 | + |
| 413 | +// rdar://97646309 -- lookup and direct call of an optional global-actor constrained method would crash in SILGen |
| 414 | +@MainActor |
| 415 | +@objc protocol OptionalMemberLookups { |
| 416 | + @objc optional func generateMaybe() async |
| 417 | +} |
| 418 | + |
| 419 | +extension OptionalMemberLookups { |
| 420 | + // CHECK-LABEL: sil hidden [ossa] @$s14dynamic_lookup21OptionalMemberLookupsPAAE19testForceDirectCallyyYaF |
| 421 | + // CHECK: [[SELF:%[0-9]+]] = copy_value {{.*}} : $Self |
| 422 | + // CHECK: [[METH:%[0-9]+]] = objc_method {{.*}} : $Self, #OptionalMemberLookups.generateMaybe!foreign : <Self where Self : OptionalMemberLookups> (Self) -> () async -> (), $@convention(objc_method) (@convention(block) () -> (), Self) -> () |
| 423 | + // CHECK: = function_ref @$sIeyB_yt14dynamic_lookup21OptionalMemberLookupsRzlTz_ : $@convention(c) @pseudogeneric <τ_0_0 where τ_0_0 : OptionalMemberLookups> (@inout_aliasable @block_storage UnsafeContinuation<(), Never>) -> () |
| 424 | + // CHECK: [[BLOCK:%[0-9]+]] = init_block_storage_header {{.*}} : $*@block_storage UnsafeContinuation<(), Never> |
| 425 | + // CHECK: = apply [[METH]]([[BLOCK]], [[SELF]]) : $@convention(objc_method) (@convention(block) () -> (), Self) -> () |
| 426 | + // CHECK: await_async_continuation {{.*}} : $Builtin.RawUnsafeContinuation, resume bb1 |
| 427 | + // CHECK: hop_to_executor {{.*}} : $MainActor |
| 428 | + // CHECK: } // end sil function '$s14dynamic_lookup21OptionalMemberLookupsPAAE19testForceDirectCallyyYaF' |
| 429 | + func testForceDirectCall() async -> Void { |
| 430 | + await self.generateMaybe!() |
| 431 | + } |
| 432 | +} |
0 commit comments