You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/Concurrency/attr_execution_conversions.swift
+66
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,11 @@
4
4
// REQUIRES: concurrency
5
5
// REQUIRES: swift_feature_ExecutionAttribute
6
6
7
+
@globalActor
8
+
actorMyActor{
9
+
staticletshared=MyActor()
10
+
}
11
+
7
12
@execution(concurrent)
8
13
func concurrentTest()async{
9
14
}
@@ -77,3 +82,64 @@ do {
77
82
// expected-error@-1 {{cannot convert value of type '(@execution(caller) () async -> ()).Type' to expected argument type '(@isolated(any) () async -> Void).Type'}}
let _:@execution(caller)(NonSendable)async->Void= globalActor1 // expected-note {{type 'NonSendable' does not conform to 'Sendable' protocol}}
102
+
// expected-error@-1 {{cannot convert '@MainActor @Sendable (NonSendable) async -> Void' to '@execution(caller) (NonSendable) async -> Void' because crossing of an isolation boundary requires parameter and result types to conform to 'Sendable' protocol}}
103
+
let _:@execution(caller)()async->NonSendable= globalActor2 // expected-note {{type 'NonSendable' does not conform to 'Sendable' protocol}}
104
+
// expected-error@-1 {{cannot convert '@MainActor @Sendable () async -> NonSendable' to '@execution(caller) () async -> NonSendable' because crossing of an isolation boundary requires parameter and result types to conform to 'Sendable' protocol}}
105
+
106
+
let _:@execution(caller)(NonSendable)async->Void= erased1 // expected-note {{type 'NonSendable' does not conform to 'Sendable' protocol}}
107
+
// expected-error@-1 {{cannot convert '@isolated(any) @Sendable (NonSendable) async -> Void' to '@execution(caller) (NonSendable) async -> Void' because crossing of an isolation boundary requires parameter and result types to conform to 'Sendable' protocol}}
108
+
let _:@execution(caller)()async->NonSendable= erased2 // expected-note {{type 'NonSendable' does not conform to 'Sendable' protocol}}
109
+
// expected-error@-1 {{cannot convert '@isolated(any) @Sendable () async -> NonSendable' to '@execution(caller) () async -> NonSendable' because crossing of an isolation boundary requires parameter and result types to conform to 'Sendable' protocol}}
110
+
111
+
let _:@execution(caller)(NonSendable)async->Void= nonIsolated1 // Ok
112
+
let _:@execution(caller)(NonSendable)async->Void= nonIsolated2 // expected-note {{type 'NonSendable' does not conform to 'Sendable' protocol}}
113
+
// expected-error@-1 {{cannot convert '@Sendable (NonSendable) async -> Void' to '@execution(caller) (NonSendable) async -> Void' because crossing of an isolation boundary requires parameter and result types to conform to 'Sendable' protocol}}
114
+
115
+
let _:@execution(caller)()async->NonSendable= nonIsolated3 // Ok
116
+
let _:@execution(caller)()async->NonSendable= nonIsolated4 // expected-note {{type 'NonSendable' does not conform to 'Sendable' protocol}}
117
+
// expected-error@-1 {{cannot convert '@Sendable () async -> NonSendable' to '@execution(caller) () async -> NonSendable' because crossing of an isolation boundary requires parameter and result types to conform to 'Sendable' protocol}}
118
+
119
+
let _:@execution(concurrent)(NonSendable)async->Void= erased1 // expected-note {{type 'NonSendable' does not conform to 'Sendable' protocol}}
120
+
// expected-warning@-1 {{cannot convert '@isolated(any) @Sendable (NonSendable) async -> Void' to '(NonSendable) async -> Void' because crossing of an isolation boundary requires parameter and result types to conform to 'Sendable' protocol}}
121
+
let _:@execution(concurrent)()async->NonSendable= erased2 // expected-note {{type 'NonSendable' does not conform to 'Sendable' protocol}}
122
+
// expected-warning@-1 {{cannot convert '@isolated(any) @Sendable () async -> NonSendable' to '() async -> NonSendable' because crossing of an isolation boundary requires parameter and result types to conform to 'Sendable' protocol}}
123
+
124
+
125
+
let _:@execution(concurrent)(NonSendable)async->Void= caller1 // expected-note {{type 'NonSendable' does not conform to 'Sendable' protocol}}
126
+
// expected-warning@-1 {{cannot convert '@execution(caller) @Sendable (NonSendable) async -> Void' to '(NonSendable) async -> Void' because crossing of an isolation boundary requires parameter and result types to conform to 'Sendable' protocol}}
127
+
let _:@execution(concurrent)()async->NonSendable= caller2 // expected-note {{type 'NonSendable' does not conform to 'Sendable' protocol}}
128
+
// expected-warning@-1 {{cannot convert '@execution(caller) @Sendable () async -> NonSendable' to '() async -> NonSendable' because crossing of an isolation boundary requires parameter and result types to conform to 'Sendable' protocol}}
129
+
130
+
let _:@MainActor(NonSendable)async->Void= nonIsolated1 // Ok
131
+
let _:@MainActor(NonSendable)async->Void= nonIsolated2 // expected-note {{type 'NonSendable' does not conform to 'Sendable' protocol}}
132
+
// expected-warning@-1 {{cannot convert '@Sendable (NonSendable) async -> Void' to '@MainActor (NonSendable) async -> Void' because crossing of an isolation boundary requires parameter and result types to conform to 'Sendable' protocol}}
133
+
134
+
let _:@MainActor()async->NonSendable= nonIsolated3 // Ok
135
+
let _:@MainActor()async->NonSendable= nonIsolated4 // expected-note {{type 'NonSendable' does not conform to 'Sendable' protocol}}
136
+
// expected-warning@-1 {{cannot convert '@Sendable () async -> NonSendable' to '@MainActor () async -> NonSendable' because crossing of an isolation boundary requires parameter and result types to conform to 'Sendable' protocol}}
137
+
138
+
let _:@MainActor(NonSendable)async->Void= caller1 // Ok
139
+
let _:@MainActor()async->NonSendable= caller2 // Ok
140
+
141
+
let _:@MyActor(NonSendable)async->Void= globalActor1
142
+
// expected-error@-1 {{cannot convert value actor-isolated to 'MainActor' to specified type actor-isolated to 'MyActor'}}
143
+
let _:@MyActor()async->NonSendable= globalActor2
144
+
// expected-error@-1 {{cannot convert value actor-isolated to 'MainActor' to specified type actor-isolated to 'MyActor'}}
0 commit comments