Skip to content

Commit 8d509ad

Browse files
committed
Test disallowing global actors on top-level vars
Adding a test to ensure that we emit an error message if there are global actors on top-level variables.
1 parent 83dbd62 commit 8d509ad

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/Concurrency/toplevel/main.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
var a = 10
55

6+
@MainActor
7+
var b = 14
8+
// CHECK: top-level code variables cannot have a global actor
9+
610
func nonIsolatedSynchronous() {
711
print(a)
812
// Swift6-CHECK: var 'a' isolated to global actor 'MainActor'

0 commit comments

Comments
 (0)