Skip to content

Commit 1068494

Browse files
committed
[NFC][Test] Add tests for actor isolation checking for local property
wrapper default initializers.
1 parent 267733a commit 1068494

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/Concurrency/global_actor_inference.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,22 @@ actor WrapperActorBad2<Wrapped> {
361361
}
362362
}
363363

364+
@propertyWrapper
365+
struct WrapperWithMainActorDefaultInit {
366+
var wrappedValue: Int { fatalError() }
367+
368+
@MainActor init() {} // expected-note {{calls to initializer 'init()' from outside of its actor context are implicitly asynchronous}}
369+
}
370+
364371
actor ActorWithWrapper {
365372
@WrapperOnActor var synced: Int = 0
366373
// expected-note@-1 3{{property declared here}}
367374
func f() {
368375
_ = synced // expected-error{{'synced' isolated to global actor}}
369376
_ = $synced // expected-error{{'$synced' isolated to global actor}}
370377
_ = _synced // expected-error{{'_synced' isolated to global actor}}
378+
379+
@WrapperWithMainActorDefaultInit var value: Int // expected-error {{call to main actor-isolated initializer 'init()' in a synchronous actor-isolated context}}
371380
}
372381
}
373382

0 commit comments

Comments
 (0)