Skip to content

Commit

Permalink
Merge pull request swiftlang#35129 from etcwilde/ewilde/global-actor-…
Browse files Browse the repository at this point in the history
…sync-function-call-test-case

[Concurrency] NFC: Adding top-level sync call with inout global actor state
  • Loading branch information
etcwilde authored Dec 17, 2020
2 parents 32b7e36 + 5bca066 commit 7afb399
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/Concurrency/global_actor_from_ordinary_context.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,11 @@ func fromAsync() async {

_ = a[1] // expected-error{{subscript 'subscript(_:)' isolated to global actor 'SomeGlobalActor' can not be referenced from this context}}
a[0] = 1 // expected-error{{subscript 'subscript(_:)' isolated to global actor 'SomeGlobalActor' can not be referenced from this context}}
}
}

// expected-note@+1{{mutable state is only available within the actor instance}}
@SomeGlobalActor var value: Int = 42

func topLevelSyncFunction(_ number: inout Int) { }
// expected-error@+1{{var 'value' isolated to global actor 'SomeGlobalActor' can not be referenced from this context}}
topLevelSyncFunction(&value)

0 comments on commit 7afb399

Please sign in to comment.