@@ -10,6 +10,9 @@ protocol Q {
1010
1111nonisolated func acceptMeta< T> ( _: T . Type ) { }
1212
13+ @MainActor
14+ func acceptMetaOnMainActor< T> ( _: T . Type ) { }
15+
1316// -------------------------------------------------------------------------
1417// Non-Sendable metatype instances that cross into other isolation domains.
1518// -------------------------------------------------------------------------
@@ -48,6 +51,12 @@ nonisolated func passMetaSmuggledAny<T: Q>(_: T.Type) {
4851 }
4952}
5053
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+
5160// -------------------------------------------------------------------------
5261// Sendable metatype instances that cross into other isolation domains.
5362// -------------------------------------------------------------------------
@@ -67,6 +76,11 @@ nonisolated func passMetaWithSendableSmuggled<T: Sendable & Q>(_: T.Type) {
6776 }
6877}
6978
79+ nonisolated func passSendableToMainActorSmuggledAny< T: Sendable > ( _: T . Type ) async {
80+ let x : Sendable . Type = T . self
81+ await acceptMetaOnMainActor ( x)
82+ }
83+
7084// -------------------------------------------------------------------------
7185// Sendable requirements on metatypes
7286// -------------------------------------------------------------------------
0 commit comments