mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Instead, use the `%target-swift-5.1-abi-triple` substitution to compile the tests for deployment to the minimum OS versions required for use of _Concurrency APIs.
23 lines
737 B
Swift
23 lines
737 B
Swift
// RUN: %target-swift-frontend -swift-version 6 -target %target-swift-5.1-abi-triple -strict-concurrency=complete -emit-sil -o /dev/null -verify %s
|
|
|
|
// REQUIRES: concurrency
|
|
|
|
@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}}
|