Skip to content

Commit c05afe2

Browse files
committed
test[Concurrency]: Add test to make sure actor isolation checking is performing in visitPatternBinding.
1 parent d0ef4d2 commit c05afe2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: test/Concurrency/global_actor_inference.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -415,12 +415,13 @@ actor WrapperActorBad2<Wrapped: Sendable> {
415415
struct WrapperWithMainActorDefaultInit {
416416
var wrappedValue: Int { fatalError() }
417417

418-
@MainActor init() {} // expected-note {{calls to initializer 'init()' from outside of its actor context are implicitly asynchronous}}
418+
@MainActor init() {} // expected-note 2 {{calls to initializer 'init()' from outside of its actor context are implicitly asynchronous}}
419419
}
420420

421421
actor ActorWithWrapper {
422422
@WrapperOnActor var synced: Int = 0
423423
// expected-note@-1 3{{property declared here}}
424+
@WrapperWithMainActorDefaultInit var property: Int // expected-error {{call to main actor-isolated initializer 'init()' in a synchronous actor-isolated context}}
424425
func f() {
425426
_ = synced // expected-error{{main actor-isolated property 'synced' can not be referenced on a different actor instance}}
426427
_ = $synced // expected-error{{global actor 'SomeGlobalActor'-isolated property '$synced' can not be referenced on a different actor instance}}

0 commit comments

Comments
 (0)