mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This effectively reverts 6823744779
The blanket removal of isolation in default-value expressions had
unintented consequences for important workflows. It's still
a problem that needs to be addressed, but we need to be more precise
about the problematic situations.
24 lines
715 B
Swift
24 lines
715 B
Swift
// RUN: %target-typecheck-verify-swift -swift-version 6 -disable-availability-checking -warn-concurrency
|
|
// REQUIRES: concurrency
|
|
|
|
// REQUIRES: asserts
|
|
|
|
@globalActor
|
|
actor GlobalActor {
|
|
static let shared = GlobalActor()
|
|
}
|
|
|
|
@GlobalActor
|
|
func globalActorFn() -> Int { return 0 } // expected-note {{calls to global function 'globalActorFn()' from outside of its actor context are implicitly asynchronous}}
|
|
|
|
@GlobalActor
|
|
class C {
|
|
var x: Int = globalActorFn()
|
|
|
|
lazy var y: Int = globalActorFn()
|
|
|
|
static var z: Int = globalActorFn()
|
|
}
|
|
|
|
var x: Int = globalActorFn() // expected-error {{call to global actor 'GlobalActor'-isolated global function 'globalActorFn()' in a synchronous main actor-isolated context}}
|