@@ -48,10 +48,10 @@ actor Convenient {
48
48
init ( throwyDesignated val: Int ) throws {
49
49
guard val > 0 else { throw BogusError . blah }
50
50
self . x = 10
51
- say ( msg: " hello? " ) // expected-error {{this use of actor 'self' can only appear in an async initializer}}
51
+ say ( msg: " hello? " ) // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
52
52
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
53
53
54
- Task { self } // expected-error {{actor 'self' can only be captured by a closure from an async initializer}}
54
+ Task { self } // expected-warning {{actor 'self' can only be captured by a closure from an async initializer}}
55
55
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
56
56
}
57
57
@@ -109,32 +109,32 @@ actor MyActor {
109
109
_ = self . x
110
110
self . y = self . x
111
111
112
- Task { self } // expected-error {{actor 'self' can only be captured by a closure from an async initializer}}
112
+ Task { self } // expected-warning {{actor 'self' can only be captured by a closure from an async initializer}}
113
113
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
114
114
115
- self . helloWorld ( ) // expected-error {{this use of actor 'self' can only appear in an async initializer}}
115
+ self . helloWorld ( ) // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
116
116
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
117
117
118
- callMethod ( self ) // expected-error {{this use of actor 'self' can only appear in an async initializer}}
118
+ callMethod ( self ) // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
119
119
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
120
120
121
- passInout ( & self . x) // expected-error {{actor 'self' can only be passed 'inout' from an async initializer}}
121
+ passInout ( & self . x) // expected-warning {{actor 'self' can only be passed 'inout' from an async initializer}}
122
122
123
123
self . x = self . y
124
124
self . x = randomInt ( )
125
125
( _, _) = ( self . x, self . y)
126
126
_ = self . x == 0
127
127
128
- self . hax = self // expected-error {{this use of actor 'self' can only appear in an async initializer}}
128
+ self . hax = self // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
129
129
_ = self . hax
130
130
131
- _ = computedProp // expected-error {{this use of actor 'self' can only appear in an async initializer}}
131
+ _ = computedProp // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
132
132
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
133
133
134
- computedProp = 1 // expected-error {{this use of actor 'self' can only appear in an async initializer}}
134
+ computedProp = 1 // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
135
135
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
136
136
137
- Task { // expected-error {{actor 'self' can only be captured by a closure from an async initializer}}
137
+ Task { // expected-warning {{actor 'self' can only be captured by a closure from an async initializer}}
138
138
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
139
139
_ = await self . hax
140
140
await self . helloWorld ( )
@@ -146,29 +146,29 @@ actor MyActor {
146
146
guard c else { return nil }
147
147
self . y = self . x
148
148
149
- Task { self } // expected-error {{actor 'self' can only be captured by a closure from an async initializer}}
149
+ Task { self } // expected-warning {{actor 'self' can only be captured by a closure from an async initializer}}
150
150
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
151
151
152
- self . helloWorld ( ) // expected-error {{this use of actor 'self' can only appear in an async initializer}}
152
+ self . helloWorld ( ) // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
153
153
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
154
154
155
- callMethod ( self ) // expected-error {{this use of actor 'self' can only appear in an async initializer}}
155
+ callMethod ( self ) // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
156
156
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
157
157
158
- passInout ( & self . x) // expected-error {{actor 'self' can only be passed 'inout' from an async initializer}}
158
+ passInout ( & self . x) // expected-warning {{actor 'self' can only be passed 'inout' from an async initializer}}
159
159
160
160
self . x = self . y
161
161
162
- self . hax = self // expected-error {{this use of actor 'self' can only appear in an async initializer}}
162
+ self . hax = self // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
163
163
_ = self . hax
164
164
165
- _ = computedProp // expected-error {{this use of actor 'self' can only appear in an async initializer}}
165
+ _ = computedProp // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
166
166
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
167
167
168
- computedProp = 1 // expected-error {{this use of actor 'self' can only appear in an async initializer}}
168
+ computedProp = 1 // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
169
169
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
170
170
171
- Task { // expected-error {{actor 'self' can only be captured by a closure from an async initializer}}
171
+ Task { // expected-warning {{actor 'self' can only be captured by a closure from an async initializer}}
172
172
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
173
173
_ = await self . hax
174
174
await self . helloWorld ( )
@@ -180,29 +180,29 @@ actor MyActor {
180
180
guard c else { return nil }
181
181
self . y = self . x
182
182
183
- Task { self } // expected-error {{actor 'self' can only be captured by a closure from an async initializer}}
183
+ Task { self } // expected-warning {{actor 'self' can only be captured by a closure from an async initializer}}
184
184
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
185
185
186
- self . helloWorld ( ) // expected-error {{this use of actor 'self' can only appear in an async initializer}}
186
+ self . helloWorld ( ) // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
187
187
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
188
188
189
- callMethod ( self ) // expected-error {{this use of actor 'self' can only appear in an async initializer}}
189
+ callMethod ( self ) // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
190
190
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
191
191
192
- passInout ( & self . x) // expected-error {{actor 'self' can only be passed 'inout' from an async initializer}}
192
+ passInout ( & self . x) // expected-warning {{actor 'self' can only be passed 'inout' from an async initializer}}
193
193
194
194
self . x = self . y
195
195
196
- self . hax = self // expected-error {{this use of actor 'self' can only appear in an async initializer}}
196
+ self . hax = self // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
197
197
_ = self . hax
198
198
199
- _ = computedProp // expected-error {{this use of actor 'self' can only appear in an async initializer}}
199
+ _ = computedProp // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
200
200
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
201
201
202
- computedProp = 1 // expected-error {{this use of actor 'self' can only appear in an async initializer}}
202
+ computedProp = 1 // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
203
203
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
204
204
205
- Task { // expected-error {{actor 'self' can only be captured by a closure from an async initializer}}
205
+ Task { // expected-warning {{actor 'self' can only be captured by a closure from an async initializer}}
206
206
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
207
207
_ = await self . hax
208
208
await self . helloWorld ( )
@@ -214,29 +214,29 @@ actor MyActor {
214
214
self . x = 0
215
215
self . y = self . x
216
216
217
- Task { self } // expected-error {{actor 'self' cannot be captured by a closure from a global-actor isolated initializer}}
217
+ Task { self } // expected-warning {{actor 'self' cannot be captured by a closure from a global-actor isolated initializer}}
218
218
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
219
219
220
- self . helloWorld ( ) // expected-error {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
220
+ self . helloWorld ( ) // expected-warning {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
221
221
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
222
222
223
- callMethod ( self ) // expected-error {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
223
+ callMethod ( self ) // expected-warning {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
224
224
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
225
225
226
- passInout ( & self . x) // expected-error {{actor 'self' cannot be passed 'inout' from a global-actor isolated initializer}}
226
+ passInout ( & self . x) // expected-warning {{actor 'self' cannot be passed 'inout' from a global-actor isolated initializer}}
227
227
228
228
self . x = self . y
229
229
230
- self . hax = self // expected-error {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
230
+ self . hax = self // expected-warning {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
231
231
_ = self . hax
232
232
233
- _ = computedProp // expected-error {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
233
+ _ = computedProp // expected-warning {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
234
234
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
235
235
236
- computedProp = 1 // expected-error {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
236
+ computedProp = 1 // expected-warning {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
237
237
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
238
238
239
- Task { // expected-error {{actor 'self' cannot be captured by a closure from a global-actor isolated initializer}}
239
+ Task { // expected-warning {{actor 'self' cannot be captured by a closure from a global-actor isolated initializer}}
240
240
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
241
241
_ = await self . hax
242
242
await self . helloWorld ( )
@@ -272,29 +272,29 @@ actor MyActor {
272
272
self . x = 0
273
273
self . y = self . x
274
274
275
- Task { self } // expected-error {{actor 'self' cannot be captured by a closure from a global-actor isolated initializer}}
275
+ Task { self } // expected-warning {{actor 'self' cannot be captured by a closure from a global-actor isolated initializer}}
276
276
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
277
277
278
- self . helloWorld ( ) // expected-error {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
278
+ self . helloWorld ( ) // expected-warning {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
279
279
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
280
280
281
- callMethod ( self ) // expected-error {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
281
+ callMethod ( self ) // expected-warning {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
282
282
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
283
283
284
- passInout ( & self . x) // expected-error {{actor 'self' cannot be passed 'inout' from a global-actor isolated initializer}}
284
+ passInout ( & self . x) // expected-warning {{actor 'self' cannot be passed 'inout' from a global-actor isolated initializer}}
285
285
286
286
self . x = self . y
287
287
288
- self . hax = self // expected-error {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
288
+ self . hax = self // expected-warning {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
289
289
_ = self . hax
290
290
291
- _ = computedProp // expected-error {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
291
+ _ = computedProp // expected-warning {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
292
292
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
293
293
294
- computedProp = 1 // expected-error {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
294
+ computedProp = 1 // expected-warning {{this use of actor 'self' cannot appear in a global-actor isolated initializer}}
295
295
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
296
296
297
- Task { // expected-error {{actor 'self' cannot be captured by a closure from a global-actor isolated initializer}}
297
+ Task { // expected-warning {{actor 'self' cannot be captured by a closure from a global-actor isolated initializer}}
298
298
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
299
299
_ = await self . hax
300
300
await self . helloWorld ( )
@@ -310,7 +310,7 @@ actor X {
310
310
311
311
init ( v1 start: Int ) {
312
312
self . counter = start
313
- Task { await self . setCounter ( start + 1 ) } // expected-error {{actor 'self' can only be captured by a closure from an async initializer}}
313
+ Task { await self . setCounter ( start + 1 ) } // expected-warning {{actor 'self' can only be captured by a closure from an async initializer}}
314
314
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
315
315
316
316
if self . counter != start {
@@ -338,7 +338,7 @@ actor EscapeArtist {
338
338
init ( attempt1: Bool ) {
339
339
self . x = 0
340
340
341
- globalVar = self // expected-error {{this use of actor 'self' can only appear in an async initializer}}
341
+ globalVar = self // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
342
342
Task { await globalVar!. isolatedMethod ( ) }
343
343
344
344
if self . x == 0 {
@@ -349,7 +349,7 @@ actor EscapeArtist {
349
349
init ( attempt2: Bool ) {
350
350
self . x = 0
351
351
352
- let wrapped : EscapeArtist ? = . some( self ) // expected-error {{this use of actor 'self' can only appear in an async initializer}}
352
+ let wrapped : EscapeArtist ? = . some( self ) // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
353
353
let selfUnchained = wrapped!
354
354
355
355
Task { await selfUnchained. isolatedMethod ( ) }
@@ -362,7 +362,7 @@ actor EscapeArtist {
362
362
self . x = 0
363
363
364
364
// expected-warning@+2 {{variable 'unchainedSelf' was never mutated; consider changing to 'let' constant}}
365
- // expected-error @+1 {{this use of actor 'self' can only appear in an async initializer}}
365
+ // expected-warning @+1 {{this use of actor 'self' can only appear in an async initializer}}
366
366
var unchainedSelf = self
367
367
368
368
unchainedSelf. nonisolated ( )
@@ -373,17 +373,17 @@ actor EscapeArtist {
373
373
374
374
let unchainedSelf = self
375
375
376
- unchainedSelf. nonisolated ( ) // expected-error {{this use of actor 'self' can only appear in an async initializer}}
376
+ unchainedSelf. nonisolated ( ) // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
377
377
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
378
378
379
- let _ = { unchainedSelf. nonisolated ( ) } // expected-error {{actor 'self' can only be captured by a closure from an async initializer}}
379
+ let _ = { unchainedSelf. nonisolated ( ) } // expected-warning {{actor 'self' can only be captured by a closure from an async initializer}}
380
380
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
381
381
}
382
382
383
383
init ( attempt5: Bool ) {
384
384
self . x = 0
385
385
386
- let box = CardboardBox ( item: self ) // expected-error {{this use of actor 'self' can only appear in an async initializer}}
386
+ let box = CardboardBox ( item: self ) // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
387
387
box. item. nonisolated ( )
388
388
}
389
389
@@ -392,7 +392,7 @@ actor EscapeArtist {
392
392
func fn( ) {
393
393
self . nonisolated ( )
394
394
}
395
- fn ( ) // expected-error {{this use of actor 'self' can only appear in an async initializer}}
395
+ fn ( ) // expected-warning {{this use of actor 'self' can only appear in an async initializer}}
396
396
// expected-note@-1 {{convenience initializers allow non-isolated use of 'self' once initialized}}
397
397
}
398
398
0 commit comments