|
15 | 15 | // REQUIRES: CPU=x86_64
|
16 | 16 | // REQUIRES: OS=macosx
|
17 | 17 | // REQUIRES: executable_test
|
| 18 | +actor MyActor { } |
18 | 19 |
|
19 | 20 | protocol MyProtocol {
|
20 | 21 | associatedtype AssocSendable
|
21 | 22 | associatedtype AssocAsync
|
22 | 23 | associatedtype AssocGlobalActor
|
| 24 | + associatedtype AssocIsolated |
23 | 25 | }
|
24 | 26 |
|
25 | 27 | typealias SendableFn = @Sendable () -> Void
|
26 | 28 | typealias AsyncFn = () async -> Void
|
27 | 29 | typealias GlobalActorFn = @MainActor () -> Void
|
| 30 | +typealias ActorIsolatedFn = (isolated MyActor) -> String |
28 | 31 |
|
29 | 32 | struct MyStruct: MyProtocol {
|
30 | 33 | typealias AssocSendable = SendableFn
|
31 | 34 | typealias AssocAsync = AsyncFn
|
32 | 35 | typealias AssocGlobalActor = GlobalActorFn
|
| 36 | + typealias AssocIsolated = ActorIsolatedFn |
33 | 37 | }
|
34 | 38 |
|
35 | 39 | func assocSendable<T: MyProtocol>(_: T.Type) -> Any.Type { return T.AssocSendable.self }
|
36 | 40 | func assocAsync<T: MyProtocol>(_: T.Type) -> Any.Type { return T.AssocAsync.self }
|
37 | 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 } |
38 | 43 |
|
39 | 44 | assert(assocSendable(MyStruct.self) == SendableFn.self)
|
40 | 45 | assert(assocAsync(MyStruct.self) == AsyncFn.self)
|
41 | 46 | assert(assocGlobalActor(MyStruct.self) == GlobalActorFn.self)
|
| 47 | +assert(assocIsolated(MyStruct.self) == ActorIsolatedFn.self) |
42 | 48 |
|
43 | 49 | // type metadata accessor for @Sendable () -> ()
|
44 | 50 | // OLD: define linkonce_odr hidden swiftcc %swift.metadata_response @"$syyYbcMa"
|
@@ -69,3 +75,9 @@ assert(assocGlobalActor(MyStruct.self) == GlobalActorFn.self)
|
69 | 75 |
|
70 | 76 | // NEW-NOT: call swiftcc %swift.metadata_response @"$syyScMYccMa"
|
71 | 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