Skip to content

Commit 3310a55

Browse files
committed
[Test] Use the SwiftStdlib 5.5 macro in Concurrency tests
1 parent 6a78e2a commit 3310a55

File tree

64 files changed

+301
-301
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+301
-301
lines changed

test/Concurrency/Runtime/actor_counters.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// UNSUPPORTED: use_os_stdlib
99
// UNSUPPORTED: back_deployment_runtime
1010

11-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
11+
@available(SwiftStdlib 5.5, *)
1212
actor Counter {
1313
private var value = 0
1414
private let scratchBuffer: UnsafeMutableBufferPointer<Int>
@@ -31,7 +31,7 @@ actor Counter {
3131
}
3232

3333

34-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
34+
@available(SwiftStdlib 5.5, *)
3535
func worker(identity: Int, counters: [Counter], numIterations: Int) async {
3636
for i in 0..<numIterations {
3737
let counterIndex = Int.random(in: 0 ..< counters.count)
@@ -41,7 +41,7 @@ func worker(identity: Int, counters: [Counter], numIterations: Int) async {
4141
}
4242
}
4343

44-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
44+
@available(SwiftStdlib 5.5, *)
4545
func runTest(numCounters: Int, numWorkers: Int, numIterations: Int) async {
4646
// Create counter actors.
4747
var counters: [Counter] = []
@@ -68,7 +68,7 @@ func runTest(numCounters: Int, numWorkers: Int, numIterations: Int) async {
6868
print("DONE!")
6969
}
7070

71-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
71+
@available(SwiftStdlib 5.5, *)
7272
@main struct Main {
7373
static func main() async {
7474
// Useful for debugging: specify counter/worker/iteration counts

test/Concurrency/Runtime/async.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import StdlibUnittest
1919

2020
var asyncTests = TestSuite("Async")
2121

22-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
22+
@available(SwiftStdlib 5.5, *)
2323
actor MyActor {
2424
func synchronous() { }
2525

@@ -31,7 +31,7 @@ actor MyActor {
3131
}
3232
}
3333

34-
if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) {
34+
if #available(SwiftStdlib 5.5, *) {
3535
let actor = MyActor()
3636

3737
asyncTests.test("Detach") {

test/Concurrency/Runtime/async_initializer.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// UNSUPPORTED: use_os_stdlib
99
// UNSUPPORTED: back_deployment_runtime
1010

11-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
11+
@available(SwiftStdlib 5.5, *)
1212
actor NameGenerator {
1313
private var counter = 0
1414
private var prefix : String
@@ -19,13 +19,13 @@ actor NameGenerator {
1919
}
2020
}
2121

22-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
22+
@available(SwiftStdlib 5.5, *)
2323
protocol Person {
2424
init() async
2525
var name : String { get set }
2626
}
2727

28-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
28+
@available(SwiftStdlib 5.5, *)
2929
class EarthPerson : Person {
3030
private static let oracle = NameGenerator("Earthling")
3131

@@ -40,7 +40,7 @@ class EarthPerson : Person {
4040
}
4141
}
4242

43-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
43+
@available(SwiftStdlib 5.5, *)
4444
class NorthAmericaPerson : EarthPerson {
4545
private static let oracle = NameGenerator("NorthAmerican")
4646
required init() async {
@@ -53,7 +53,7 @@ class NorthAmericaPerson : EarthPerson {
5353
}
5454
}
5555

56-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
56+
@available(SwiftStdlib 5.5, *)
5757
class PrecariousClass {
5858
init?(nilIt : Int) async {
5959
let _ : Optional<Int> = await (detach { nil }).get()
@@ -87,7 +87,7 @@ enum Something : Error {
8787
case bogus
8888
}
8989

90-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
90+
@available(SwiftStdlib 5.5, *)
9191
struct PrecariousStruct {
9292
init?(nilIt : Int) async {
9393
let _ : Optional<Int> = await (detach { nil }).get()
@@ -122,7 +122,7 @@ struct PrecariousStruct {
122122
// CHECK-NEXT: struct threw
123123
// CHECK: done
124124

125-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
125+
@available(SwiftStdlib 5.5, *)
126126
@main struct RunIt {
127127
static func main() async {
128128
let people : [Person] = [

test/Concurrency/Runtime/async_let_fibonacci.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func fib(_ n: Int) -> Int {
1919
return first
2020
}
2121

22-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
22+
@available(SwiftStdlib 5.5, *)
2323
func asyncFib(_ n: Int) async -> Int {
2424
if n == 0 || n == 1 {
2525
return n
@@ -39,7 +39,7 @@ func asyncFib(_ n: Int) async -> Int {
3939
return result
4040
}
4141

42-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
42+
@available(SwiftStdlib 5.5, *)
4343
func runFibonacci(_ n: Int) async {
4444
let result = await asyncFib(n)
4545

@@ -48,7 +48,7 @@ func runFibonacci(_ n: Int) async {
4848
assert(result == fib(n))
4949
}
5050

51-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
51+
@available(SwiftStdlib 5.5, *)
5252
@main struct Main {
5353
static func main() async {
5454
await runFibonacci(10)

test/Concurrency/Runtime/async_let_throws.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func boom() throws -> Int {
1414
throw Boom()
1515
}
1616

17-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
17+
@available(SwiftStdlib 5.5, *)
1818
func test() async {
1919
async let result = boom()
2020

@@ -25,7 +25,7 @@ func test() async {
2525
}
2626
}
2727

28-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
28+
@available(SwiftStdlib 5.5, *)
2929
@main struct Main {
3030
static func main() async {
3131
await test()

test/Concurrency/Runtime/async_sequence.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,35 @@ import StdlibUnittest
1414
// Utility functions for closure based operators to force them into throwing
1515
// and async and throwing async contexts.
1616

17-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
17+
@available(SwiftStdlib 5.5, *)
1818
func throwing<T>(_ value: T) throws -> T {
1919
return value
2020
}
2121

22-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
22+
@available(SwiftStdlib 5.5, *)
2323
func asynchronous<T>(_ value: T) async -> T {
2424
return value
2525
}
2626

27-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
27+
@available(SwiftStdlib 5.5, *)
2828
func asynchronousThrowing<T>(_ value: T) async throws -> T {
2929
return value
3030
}
3131

32-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
32+
@available(SwiftStdlib 5.5, *)
3333
struct Failure: Error, Equatable {
3434
var value = 1
3535
}
3636

37-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
37+
@available(SwiftStdlib 5.5, *)
3838
func failable<T, E: Error>(
3939
_ results: [Result<T, E>]
4040
) -> AsyncThrowingMapSequence<AsyncLazySequence<[Result<T, E>]>, T> {
4141
return results.async.map { try $0.get() }
4242
}
4343

4444

45-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
45+
@available(SwiftStdlib 5.5, *)
4646
extension Sequence {
4747
@inlinable
4848
public var async: AsyncLazySequence<Self> {
@@ -52,7 +52,7 @@ extension Sequence {
5252
}
5353
}
5454

55-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
55+
@available(SwiftStdlib 5.5, *)
5656
public struct AsyncLazySequence<S: Sequence>: AsyncSequence {
5757
public typealias Element = S.Element
5858
public typealias AsyncIterator = Iterator
@@ -85,7 +85,7 @@ public struct AsyncLazySequence<S: Sequence>: AsyncSequence {
8585
}
8686
}
8787

88-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
88+
@available(SwiftStdlib 5.5, *)
8989
extension AsyncSequence {
9090
@inlinable
9191
public func collect() async rethrows -> [Element] {
@@ -98,7 +98,7 @@ extension AsyncSequence {
9898
}
9999
}
100100

101-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
101+
@available(SwiftStdlib 5.5, *)
102102
extension AsyncSequence where Element: Equatable {
103103
func `throw`(_ error: Error, on element: Element) -> AsyncThrowingMapSequence<Self, Element> {
104104
return map { (value: Element) throws -> Element in
@@ -110,7 +110,7 @@ extension AsyncSequence where Element: Equatable {
110110

111111
@main struct Main {
112112
static func main() async {
113-
if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) {
113+
if #available(SwiftStdlib 5.5, *) {
114114

115115
var AsyncLazySequenceTests = TestSuite("AsyncLazySequence")
116116

test/Concurrency/Runtime/async_task_async_let_child_cancel.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// UNSUPPORTED: back_deployment_runtime
88
// UNSUPPORTED: use_os_stdlib
99

10-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
10+
@available(SwiftStdlib 5.5, *)
1111
func printWaitPrint(_ int: Int) async -> Int {
1212
print("start, cancelled:\(Task.isCancelled), id:\(int)")
1313
while !Task.isCancelled {
@@ -17,7 +17,7 @@ func printWaitPrint(_ int: Int) async -> Int {
1717
return int
1818
}
1919

20-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
20+
@available(SwiftStdlib 5.5, *)
2121
func test() async {
2222
let h = detach {
2323
await printWaitPrint(0)
@@ -68,7 +68,7 @@ func test() async {
6868
print("exit")
6969
}
7070

71-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
71+
@available(SwiftStdlib 5.5, *)
7272
@main struct Main {
7373
static func main() async {
7474
await test()

test/Concurrency/Runtime/async_task_cancellation_early.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import Dispatch
1212

13-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
13+
@available(SwiftStdlib 5.5, *)
1414
func test_detach_cancel_child_early() async {
1515
print(#function) // CHECK: test_detach_cancel_child_early
1616
let h: Task.Handle<Bool, Error> = detach {
@@ -35,7 +35,7 @@ func test_detach_cancel_child_early() async {
3535
print("was cancelled: \(got)") // CHECK: was cancelled: true
3636
}
3737

38-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
38+
@available(SwiftStdlib 5.5, *)
3939
@main struct Main {
4040
static func main() async {
4141
await test_detach_cancel_child_early()

test/Concurrency/Runtime/async_task_cancellation_while_running.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import Dispatch
1212

13-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
13+
@available(SwiftStdlib 5.5, *)
1414
func test_detach_cancel_while_child_running() async {
1515
let h: Task.Handle<Bool, Error> = detach {
1616
async let childCancelled: Bool = { () -> Bool in
@@ -34,7 +34,7 @@ func test_detach_cancel_while_child_running() async {
3434
print("was cancelled: \(got)") // CHECK: was cancelled: true
3535
}
3636

37-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
37+
@available(SwiftStdlib 5.5, *)
3838
@main struct Main {
3939
static func main() async {
4040
await test_detach_cancel_while_child_running()

test/Concurrency/Runtime/async_task_detach.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class X {
2121

2222
struct Boom: Error {}
2323

24-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
24+
@available(SwiftStdlib 5.5, *)
2525
func test_detach() async {
2626
let x = X()
2727
let h = detach {
@@ -33,7 +33,7 @@ func test_detach() async {
3333
// CHECK: X: deinit
3434
}
3535

36-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
36+
@available(SwiftStdlib 5.5, *)
3737
func test_detach_throw() async {
3838
let x = X()
3939
let h = detach {
@@ -51,7 +51,7 @@ func test_detach_throw() async {
5151
}
5252

5353

54-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
54+
@available(SwiftStdlib 5.5, *)
5555
@main struct Main {
5656
static func main() async {
5757
await test_detach()

test/Concurrency/Runtime/async_task_handle_cancellation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//
1515
// UNSUPPORTED: OS=windows-msvc
1616

17-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
17+
@available(SwiftStdlib 5.5, *)
1818
@main struct Main {
1919
static func main() async {
2020
let handle = detach {

0 commit comments

Comments
 (0)