Skip to content

Commit a98a8e6

Browse files
committed
[Tests] Add a test for accessing globally-isolated Sendable mutable storage of a Sendable value type from outside of the module.
1 parent 3912ead commit a98a8e6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/Concurrency/nonisolated_access.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
/// Build the library A
55
// RUN: %target-swift-frontend -emit-module %t/src/A.swift \
6-
// RUN: -disable-availability-checking \
6+
// RUN: -disable-availability-checking -verify \
77
// RUN: -module-name A -swift-version 6 \
88
// RUN: -emit-module-path %t/A.swiftmodule
99

1010
// Build the client
1111
// RUN: %target-swift-frontend -emit-module %t/src/Client.swift \
12-
// RUN: -disable-availability-checking \
12+
// RUN: -disable-availability-checking -verify \
1313
// RUN: -module-name Client -I %t -swift-version 6 \
1414
// RUN: -emit-module-path %t/Client.swiftmodule
1515

@@ -28,6 +28,7 @@ public struct ImplicitlySendable {
2828

2929
public struct S: P {
3030
nonisolated public var x: Int = 0
31+
public var y: Int = 1
3132

3233
nonisolated public init() {}
3334
}
@@ -39,6 +40,8 @@ actor A {
3940
func test() {
4041
var s = S()
4142
s.x += 0 // okay
43+
// expected-error@+1 {{main actor-isolated property 'y' can not be mutated on a nonisolated actor instance}}
44+
s.y += 1
4245
var sendable = ImplicitlySendable()
4346
sendable.prop = false // okay
4447
}

0 commit comments

Comments
 (0)