It is possible to actor isolate the wrappedValue of a property wrapper and interact with it in a nonisolated way, leading to a crash.
Reproduction
@propertyWrapper
struct Count {
@MainActor var value = 0
@MainActor
var wrappedValue: Int {
get { value }
set { value = newValue }
}
}
@Test func f() async {
@Count var count
count += 1 // 💥
}
Stack dump
N/A. Produces code that crashes at runtime. Doesn't crash the compiler.
Expected behavior
I expect the line that crashes to not compile with a message such as:
Main actor-isolated property 'wrappedValue' can not be mutated from a nonisolated context
Environment
swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Target: arm64-apple-macosx15.0
Description
It is possible to actor isolate the
wrappedValue
of a property wrapper and interact with it in a nonisolated way, leading to a crash.Reproduction
Stack dump
Expected behavior
I expect the line that crashes to not compile with a message such as:
Environment
swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4) Target: arm64-apple-macosx15.0
Additional information
No response