@@ -10,6 +10,9 @@ protocol Q {
10
10
11
11
nonisolated func acceptMeta< T> ( _: T . Type ) { }
12
12
13
+ @MainActor
14
+ func acceptMetaOnMainActor< T> ( _: T . Type ) { }
15
+
13
16
// -------------------------------------------------------------------------
14
17
// Non-Sendable metatype instances that cross into other isolation domains.
15
18
// -------------------------------------------------------------------------
@@ -48,6 +51,12 @@ nonisolated func passMetaSmuggledAny<T: Q>(_: T.Type) {
48
51
}
49
52
}
50
53
54
+ nonisolated func passToMainActorSmuggledAny< T: Q > ( _: T . Type ) async {
55
+ let x : Any . Type = T . self
56
+ await acceptMetaOnMainActor ( x) // expected-error{{sending value of non-Sendable type '(Any).Type' risks causing data races}}
57
+ // expected-note@-1{{sending task-isolated value of non-Sendable type '(Any).Type' to main actor-isolated global function}}
58
+ }
59
+
51
60
// -------------------------------------------------------------------------
52
61
// Sendable metatype instances that cross into other isolation domains.
53
62
// -------------------------------------------------------------------------
@@ -67,6 +76,11 @@ nonisolated func passMetaWithSendableSmuggled<T: Sendable & Q>(_: T.Type) {
67
76
}
68
77
}
69
78
79
+ nonisolated func passSendableToMainActorSmuggledAny< T: Sendable > ( _: T . Type ) async {
80
+ let x : Sendable . Type = T . self
81
+ await acceptMetaOnMainActor ( x)
82
+ }
83
+
70
84
// -------------------------------------------------------------------------
71
85
// Sendable requirements on metatypes
72
86
// -------------------------------------------------------------------------
0 commit comments