forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathavailability_global_actor.swift
37 lines (27 loc) · 1.04 KB
/
availability_global_actor.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// RUN: %target-typecheck-verify-swift -target %target-cpu-apple-macosx10.50
// REQUIRES: concurrency
// REQUIRES: OS=macosx
actor SomeActor {}
@globalActor struct AlwaysAvailableGA {
static let shared = SomeActor()
}
@available(macOS 10.51, *)
@globalActor struct Available10_51GA {
static let shared = SomeActor()
}
@available(*, unavailable)
@globalActor struct UnavailableGA { // expected-note {{'UnavailableGA' has been explicitly marked unavailable here}}
static let shared = SomeActor()
}
@AlwaysAvailableGA
struct AlwaysAvailableWithAlwaysAvailableGA {}
@Available10_51GA // expected-error {{'Available10_51GA' is only available in macOS 10.51 or newer}}
struct AlwaysAvailableWithAvailable10_51GA {} // expected-note {{add @available attribute to enclosing struct}}
@available(macOS 10.51, *)
@Available10_51GA
struct Always10_51WithAvailable10_51GA {}
@UnavailableGA // expected-error {{'UnavailableGA' is unavailable}}
struct AlwaysAvailableWithUnavailableGA {}
@available(*, unavailable)
@UnavailableGA
struct UnavailableWithUnavailableGA {}