Skip to content

Commit 6d2fc9e

Browse files
committed
Add @Availability to some concurrency tests that were missing it.
1 parent 1173b73 commit 6d2fc9e

File tree

9 files changed

+34
-0
lines changed

9 files changed

+34
-0
lines changed

test/DebugInfo/async-boxed-arg.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// RUN: -module-name M -enable-experimental-concurrency | %FileCheck %s
33
// REQUIRES: concurrency
44

5+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
56
extension Collection {
67
public func f() async throws {
78
return await try Task.withGroup(resultType: Element.self) { group in

test/ModuleInterface/Inputs/MeowActor.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
12
@globalActor public final class MeowActor {
23
public static let shared = _Impl()
34

test/ModuleInterface/actor_protocol.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,46 @@
1212
// CHECK-EXTENSION-NOT: extension {{.+}} : _Concurrency.Actor
1313

1414
// CHECK: public actor PlainActorClass {
15+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1516
public actor PlainActorClass {
1617
@actorIndependent public func enqueue(partialTask: PartialAsyncTask) { }
1718
}
1819

1920
// CHECK: public actor ExplicitActorClass : _Concurrency.Actor {
21+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2022
public actor ExplicitActorClass : Actor {
2123
@actorIndependent public func enqueue(partialTask: PartialAsyncTask) { }
2224
}
2325

2426
// CHECK: public actor EmptyActor {
27+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2528
public actor EmptyActor {}
2629

2730
// CHECK: actor public class EmptyActorClass {
31+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2832
public actor class EmptyActorClass {}
2933

3034
// CHECK: public protocol Cat : _Concurrency.Actor {
35+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
3136
public protocol Cat : Actor {
3237
func mew()
3338
}
3439

3540
// CHECK: public actor HouseCat : Library.Cat {
41+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
3642
public actor HouseCat : Cat {
3743
@asyncHandler public func mew() {}
3844
@actorIndependent public func enqueue(partialTask: PartialAsyncTask) { }
3945
}
4046

4147
// CHECK: public protocol ToothyMouth {
48+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
4249
public protocol ToothyMouth {
4350
func chew()
4451
}
4552

4653
// CHECK: public actor Lion : Library.ToothyMouth, _Concurrency.Actor {
54+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
4755
public actor Lion : ToothyMouth, Actor {
4856
@asyncHandler public func chew() {}
4957
@actorIndependent public func enqueue(partialTask: PartialAsyncTask) { }

test/ModuleInterface/global-actor.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import MeowActor
55

6+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
67
@MeowActor func doMeow() {}
78

89
// RUN: %target-swift-frontend -enable-experimental-concurrency -enable-library-evolution -emit-module -o %t/MeowActor.swiftmodule %S/Inputs/MeowActor.swift
@@ -13,6 +14,7 @@ import MeowActor
1314
// RUN: %target-swift-frontend -enable-experimental-concurrency -emit-silgen %s -I %t | %FileCheck --check-prefix CHECK-FRAGILE %s
1415
// CHECK-FRAGILE: metatype $@thin MeowActor.Type
1516

17+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1618
func someFunc() async {
1719
await doMeow()
1820
}

test/Sanitizers/tsan/actor_counters.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Darwin
1313
import Glibc
1414
#endif
1515

16+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1617
actor Counter {
1718
private var value = 0
1819
private let scratchBuffer: UnsafeMutableBufferPointer<Int>
@@ -41,6 +42,7 @@ actor Counter {
4142
}
4243

4344

45+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
4446
func worker(identity: Int, counters: [Counter], numIterations: Int) async {
4547
for i in 0..<numIterations {
4648
let counterIndex = Int.random(in: 0 ..< counters.count)
@@ -50,6 +52,7 @@ func worker(identity: Int, counters: [Counter], numIterations: Int) async {
5052
}
5153
}
5254

55+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
5356
func runTest(numCounters: Int, numWorkers: Int, numIterations: Int) async {
5457
// Create counter actors.
5558
var counters: [Counter] = []
@@ -76,6 +79,7 @@ func runTest(numCounters: Int, numWorkers: Int, numIterations: Int) async {
7679
print("DONE!")
7780
}
7881

82+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
7983
@main struct Main {
8084
static func main() async {
8185
// Useful for debugging: specify counter/worker/iteration counts

test/Sanitizers/tsan/basic_future.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ enum HomeworkError: Error, Equatable {
1717
case dogAteIt(String)
1818
}
1919

20+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2021
func formGreeting(name: String) async -> String {
2122
return "Hello \(name) from async world"
2223
}
2324

25+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2426
func testSimple(
2527
name: String, dogName: String, shouldThrow: Bool, doSuspend: Bool
2628
) async {
@@ -73,6 +75,7 @@ func testSimple(
7375
}
7476

7577

78+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
7679
@main struct Main {
7780
static func main() async {
7881
await testSimple(name: "Ted", dogName: "Hazel", shouldThrow: false, doSuspend: false)

test/Sanitizers/tsan/racy_actor_counters.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
var globalCounterValue = 0
1717

18+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1819
actor Counter {
1920
func next() -> Int {
2021
let current = globalCounterValue
@@ -23,6 +24,7 @@ actor Counter {
2324
}
2425
}
2526

27+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2628
func worker(identity: Int, counters: [Counter], numIterations: Int) async {
2729
for _ in 0..<numIterations {
2830
let counterIndex = Int.random(in: 0 ..< counters.count)
@@ -32,6 +34,7 @@ func worker(identity: Int, counters: [Counter], numIterations: Int) async {
3234
}
3335
}
3436

37+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
3538
func runTest(numCounters: Int, numWorkers: Int, numIterations: Int) async {
3639
// Create counter actors.
3740
var counters: [Counter] = []
@@ -57,6 +60,7 @@ func runTest(numCounters: Int, numWorkers: Int, numIterations: Int) async {
5760
print("DONE!")
5861
}
5962

63+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
6064
@main struct Main {
6165
static func main() async {
6266
// Useful for debugging: specify counter/worker/iteration counts

test/decl/protocol/special/Actor.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,53 @@
33

44
// Synthesis of for actores.
55

6+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
67
actor A1 {
78
var x: Int = 17
89
}
910

11+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1012
actor A2: Actor {
1113
var x: Int = 17
1214
}
1315

16+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1417
actor A3<T>: Actor {
1518
var x: Int = 17
1619
}
1720

21+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
1822
actor A4: A1 {
1923
}
2024

25+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2126
actor A5: A2 {
2227
}
2328

29+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
2430
actor A6: A1, Actor { // expected-error{{redundant conformance of 'A6' to protocol 'Actor'}}
2531
// expected-note@-1{{'A6' inherits conformance to protocol 'Actor' from superclass here}}
2632
}
2733

2834
// Explicitly satisfying the requirement.
2935

36+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
3037
actor A7 {
3138
// Okay: satisfy the requirement explicitly
3239
nonisolated func enqueue(partialTask: PartialAsyncTask) { }
3340
}
3441

3542
// A non-actor can conform to the Actor protocol, if it does it properly.
43+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
3644
class C1: Actor { // expected-error{{non-final class 'C1' cannot conform to `Sendable`; use `UnsafeSendable`}}
3745
func enqueue(partialTask: PartialAsyncTask) { }
3846
}
3947

4048
// Make sure the conformances actually happen.
49+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
4150
func acceptActor<T: Actor>(_: T.Type) { }
4251

52+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
4353
func testConformance() {
4454
acceptActor(A1.self)
4555
acceptActor(A2.self)

test/stmt/errors_async.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ enum MyError : Error {
66
case bad
77
}
88

9+
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
910
func shouldThrow() async {
1011
// expected-error@+1 {{errors thrown from here are not handled}}
1112
let _: Int = try await withUnsafeThrowingContinuation { continuation in

0 commit comments

Comments
 (0)