|
15 | 15 | // REQUIRES: CPU=x86_64 |
16 | 16 | // REQUIRES: OS=macosx |
17 | 17 | // REQUIRES: executable_test |
18 | | - |
19 | | -// rdar://83465277 - failing when using OS stdlib on 10.15 and earlier. |
20 | | -// UNSUPPORTED: use_os_stdlib |
| 18 | +actor MyActor { } |
21 | 19 |
|
22 | 20 | protocol MyProtocol { |
23 | 21 | associatedtype AssocSendable |
24 | 22 | associatedtype AssocAsync |
25 | 23 | associatedtype AssocGlobalActor |
| 24 | + associatedtype AssocIsolated |
26 | 25 | } |
27 | 26 |
|
28 | 27 | typealias SendableFn = @Sendable () -> Void |
29 | 28 | typealias AsyncFn = () async -> Void |
30 | 29 | typealias GlobalActorFn = @MainActor () -> Void |
| 30 | +typealias ActorIsolatedFn = (isolated MyActor) -> String |
31 | 31 |
|
32 | 32 | struct MyStruct: MyProtocol { |
33 | 33 | typealias AssocSendable = SendableFn |
34 | 34 | typealias AssocAsync = AsyncFn |
35 | 35 | typealias AssocGlobalActor = GlobalActorFn |
| 36 | + typealias AssocIsolated = ActorIsolatedFn |
36 | 37 | } |
37 | 38 |
|
38 | 39 | func assocSendable<T: MyProtocol>(_: T.Type) -> Any.Type { return T.AssocSendable.self } |
39 | 40 | func assocAsync<T: MyProtocol>(_: T.Type) -> Any.Type { return T.AssocAsync.self } |
40 | 41 | func assocGlobalActor<T: MyProtocol>(_: T.Type) -> Any.Type { return T.AssocGlobalActor.self } |
| 42 | +func assocIsolated<T: MyProtocol>(_: T.Type) -> Any.Type { return T.AssocIsolated.self } |
41 | 43 |
|
42 | 44 | assert(assocSendable(MyStruct.self) == SendableFn.self) |
43 | 45 | assert(assocAsync(MyStruct.self) == AsyncFn.self) |
44 | 46 | assert(assocGlobalActor(MyStruct.self) == GlobalActorFn.self) |
| 47 | +assert(assocIsolated(MyStruct.self) == ActorIsolatedFn.self) |
45 | 48 |
|
46 | 49 | // type metadata accessor for @Sendable () -> () |
47 | 50 | // OLD: define linkonce_odr hidden swiftcc %swift.metadata_response @"$syyYbcMa" |
@@ -72,3 +75,9 @@ assert(assocGlobalActor(MyStruct.self) == GlobalActorFn.self) |
72 | 75 |
|
73 | 76 | // NEW-NOT: call swiftcc %swift.metadata_response @"$syyScMYccMa" |
74 | 77 | // NEW: call %swift.type* @__swift_instantiateConcreteTypeFromMangledName({ i32, i32 }* @"$syyScMYccMD") |
| 78 | + |
| 79 | +// OLD: call swiftcc %swift.metadata_response @"$sSS4main7MyActorCYicMa"(i64 0) #3 |
| 80 | +// OLD-NOT: call %swift.type* @__swift_instantiateConcreteTypeFromMangledName({ i32, i32 }* @"$sSS4main7MyActorCYicMD") |
| 81 | + |
| 82 | +// NEW-NOT: call swiftcc %swift.metadata_response @"$sSS4main7MyActorCYicMa"(i64 0) #3 |
| 83 | +// NEW: call %swift.type* @__swift_instantiateConcreteTypeFromMangledName({ i32, i32 }* @"$sSS4main7MyActorCYicMD") |
0 commit comments