Skip to content

Commit c2188ff

Browse files
[5.1] Replace all 9999 availability in non-stdlib tests. (#26109) (#26145)
* Replace all 9999 availability in non-stdlib tests. (#26109) Replace all 9999 availability in non-stdlib tests with the appropriate platform availability. * Merge pull request #26129 from aschwaighofer/fix_test_dynamic_replacement_opaque_result Fix test/Interpreter/dynamic_replacement_opaque_result.swift
1 parent 14c12e5 commit c2188ff

18 files changed

+122
-129
lines changed
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
protocol P {
2-
func myValue() -> Int
2+
func myValue() -> Int64
33
}
44

5-
extension Int: P {
6-
public func myValue() -> Int {
5+
extension Int64: P {
6+
public func myValue() -> Int64 {
77
return self
88
}
99

1010
}
1111

12-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
13-
func bar(_ x: Int) -> some P {
12+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
13+
func bar(_ x: Int64) -> some P {
1414
return x
1515
}
1616

1717
struct Container {
18-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
19-
func bar(_ x: Int) -> some P {
18+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
19+
func bar(_ x: Int64) -> some P {
2020
return x
2121
}
2222

23-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
23+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
2424
var computedProperty : some P {
2525
get {
26-
return 2
26+
return Int64(2)
2727
}
2828
set {
2929
print("original \(newValue)")
3030
}
3131
}
3232

33-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
33+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
3434
subscript(_ x: Int) -> some P {
3535
get {
36-
return 2
36+
return Int64(2)
3737
}
3838
set {
3939
print("original \(newValue)")
@@ -45,17 +45,17 @@ protocol Q {}
4545

4646
struct NewType : Q {}
4747

48-
extension Int : Q {}
48+
extension Int64 : Q {}
4949

5050
public protocol Assoc {
5151
associatedtype A = Int
52-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
52+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
5353
func act() -> A
5454
}
5555

5656
struct Test : Assoc {
57-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
57+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
5858
func act() -> some Q {
59-
return 1
59+
return Int64(1)
6060
}
6161
}

test/Interpreter/Inputs/dynamic_replacement_opaque2.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
@_private(sourceFile: "TestOpaque1.swift") import TestOpaque1
22

33
struct Pair : P {
4-
var x = 0
5-
var y = 1
6-
func myValue() -> Int{
4+
var x = Int64(0)
5+
var y = Int64(1)
6+
func myValue() -> Int64 {
77
return y
88
}
99
}
1010

11-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
11+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
1212
@_dynamicReplacement(for:bar(_:))
13-
func _replacement_bar(y x: Int) -> some P {
13+
func _replacement_bar(y x: Int64) -> some P {
1414
return Pair()
1515
}
1616

1717
extension Container {
18-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
18+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
1919
@_dynamicReplacement(for:bar(_:))
20-
func _replacement_bar(y x: Int) -> some P {
20+
func _replacement_bar(y x: Int64) -> some P {
2121
return Pair()
2222
}
2323

24-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
24+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
2525
@_dynamicReplacement(for: computedProperty)
2626
var _replacement_computedProperty : some P {
2727
get {
@@ -32,7 +32,7 @@ extension Container {
3232
}
3333
}
3434

35-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
35+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
3636
@_dynamicReplacement(for: subscript(_:))
3737
subscript(y x: Int) -> some P {
3838
get {
@@ -45,7 +45,7 @@ extension Container {
4545
}
4646

4747
extension Test {
48-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
48+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
4949
@_dynamicReplacement(for: act)
5050
func act_r() -> some Q {
5151
return NewType()

test/Interpreter/SDK/SwiftNativeNSXXXCoding.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private func test<T: NSObject & NSCoding>(type: T.Type) {
3131
// Test all the classes listed in SwiftNativeNSXXXBase.mm.gyb except for
3232
// NSEnumerator (which doesn't conform to NSCoding).
3333

34-
if #available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *) {
34+
if #available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *) {
3535
testSuite.test("NSArray") {
3636
test(type: NSArray.self)
3737
}

test/Interpreter/SDK/check_class_for_archiving.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ print("DerivedClassWithName: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeye
5252
// CHECK: NSKeyedUnarchiver: 0
5353
print("NSKeyedUnarchiver: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(NSKeyedUnarchiver.self, operation: op))")
5454

55-
if #available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *) {
55+
if #available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *) {
5656
// CHECK: PrivateClass: 2
5757
print("PrivateClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(PrivateClass.self, operation: op))")
5858
// CHECK: GenericClass: 1

test/Interpreter/SDK/check_class_for_archiving_log.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import Foundation
1414

1515
// A tricky way to make the FileCheck tests conditional on the OS version.
16-
if #available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *) {
16+
if #available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *) {
1717
print("-check-prefix=CHECK")
1818
} else {
1919
// Disable the checks for older OSes because of rdar://problem/50504765

test/Interpreter/SDK/objc_getClass.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ testSuite.test("GenericMangled")
179179
reason: "objc_getClass hook not present"))
180180
.requireOwnProcess()
181181
.code {
182-
guard #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) else { return }
182+
guard #available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) else { return }
183183
requireClass(named: "_TtC4main24ConstrainedSwiftSubclass",
184184
demangledName: "main.ConstrainedSwiftSubclass")
185185
requireClass(named: "_TtC4main26ConstrainedSwiftSuperclass",
@@ -226,7 +226,7 @@ testSuite.test("ResilientNSObject")
226226
reason: "objc_getClass hook not present"))
227227
.requireOwnProcess()
228228
.code {
229-
guard #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) else { return }
229+
guard #available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *) else { return }
230230
requireClass(named: "_TtC4main27ResilientSubclassOfNSObject",
231231
demangledName: "main.ResilientSubclassOfNSObject")
232232
requireClass(named: "_TtC4main34ResilientSubclassOfGenericNSObject",

test/Interpreter/dynamic_replacement_multifile/Inputs/dynamic_replacement_multi_file_A.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ func replaceable1_r() -> Int {
77
return 2
88
}
99

10-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
10+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
1111
dynamic func bar1(_ x: Int) -> some P {
1212
return x
1313
}
1414

15-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
15+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
1616
@_dynamicReplacement(for: bar1(_:))
1717
func bar1_r(_ x: Int) -> some P {
1818
return Pair()
1919
}
2020

21-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
21+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
2222
dynamic func bar2(_ x: Int) -> some P {
2323
return x
2424
}
2525

26-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
26+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
2727
@_dynamicReplacement(for: bar2(_:))
2828
func bar2_r(_ x: Int) -> some P {
2929
return Pair()

test/Interpreter/dynamic_replacement_multifile/Inputs/dynamic_replacement_multi_file_B.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ func replaceable2_r() -> Int {
77
return 3
88
}
99

10-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
10+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
1111
dynamic func bar3(_ x: Int) -> some P {
1212
return x
1313
}
1414

15-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
15+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
1616
@_dynamicReplacement(for: bar3(_:))
1717
func bar3_r(_ x: Int) -> some P {
1818
return Pair()

test/Interpreter/dynamic_replacement_multifile/main.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ struct Pair {
3434

3535
extension Pair : P {}
3636

37-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
37+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
3838
dynamic func bar(_ x: Int) -> some P {
3939
return x
4040
}
4141

42-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
42+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
4343
@_dynamicReplacement(for: bar(_:))
4444
func bar_r(_ x: Int) -> some P {
4545
return Pair()
@@ -52,13 +52,12 @@ DynamicallyReplaceable.test("DynamicallyReplaceable") {
5252
expectEqual(2, replaceable1())
5353
expectEqual(3, replaceable2())
5454
expectEqual(7, replaceableInOtherFile())
55-
if #available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) {
55+
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
5656
expectEqual(16, MemoryLayout.size(ofValue: bar(5)))
5757
expectEqual(16, MemoryLayout.size(ofValue: bar1(5)))
5858
expectEqual(16, MemoryLayout.size(ofValue: bar2(5)))
5959
expectEqual(16, MemoryLayout.size(ofValue: bar3(5)))
6060
}
61-
6261
}
6362

6463
runAllTests()

test/Interpreter/dynamic_replacement_opaque_result.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func testAssociatedType<T: Assoc> (_ t: T) {
3636
print(T.A.self)
3737
}
3838

39-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
39+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
4040
func test() {
4141
print(MemoryLayout.size(ofValue: bar(5)))
4242
print(MemoryLayout.size(ofValue: Container().bar(5)))
@@ -56,7 +56,7 @@ func test() {
5656
// CHECK: 2
5757
// CHECK: 8
5858
// CHECK: 2
59-
if #available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) {
59+
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
6060
test()
6161
} else {
6262
print("8 8 5 5 8 2 8 2")
@@ -82,7 +82,7 @@ executablePath.removeLast(4)
8282
// CHECK: 16
8383
// CHECK: 1
8484
// CHECK: NewType
85-
if #available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) {
85+
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
8686
test()
8787
testAssociatedType(Test())
8888
} else {

test/Interpreter/dynamic_replacement_opaque_result2.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public protocol Assoc {
1111
associatedtype A = Int
1212

13-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
13+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
1414
func act() -> A
1515
}
1616

@@ -29,14 +29,14 @@ extension Int : P {
2929
struct Pair : P {}
3030

3131
struct Test : Assoc {
32-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
32+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
3333
dynamic func act() -> some P {
3434
return 1
3535
}
3636
}
3737

3838
extension Test {
39-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
39+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
4040
@_dynamicReplacement(for: act)
4141
func act_r() -> some P {
4242
return Pair()
@@ -46,7 +46,7 @@ extension Test {
4646
func test() {
4747
let t = Test()
4848
// CHECK: Pair
49-
if #available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *) {
49+
if #available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) {
5050
testAssociatedType(t)
5151
} else {
5252
print("Pair")

test/Interpreter/opaque_return_type_protocol_ext.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
// RUN: %target-run-simple-swift | %FileCheck %s
22
// REQUIRES: executable_test
33

4-
@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
4+
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
55
protocol P {
66
associatedtype AT
77
func foo() -> AT
88
}
99

10-
@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
10+
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
1111
struct Adapter<T: P>: P {
1212
var inner: T
1313

14-
@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
14+
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
1515
func foo() -> some P {
1616
return inner
1717
}
1818
}
1919

20-
@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
20+
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
2121
extension P {
22-
@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
22+
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
2323
func foo() -> some P {
2424
return Adapter(inner: self)
2525
}
2626
}
2727

28-
@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
28+
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
2929
func getPAT<T: P>(_: T.Type) -> Any.Type {
3030
return T.AT.self
3131
}
3232

33-
@available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *)
33+
@available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *)
3434
extension Int: P { }
3535

3636
// CHECK: {{Adapter<Int>|too old}}
37-
if #available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *) {
37+
if #available(iOS 13, macOS 10.15, tvOS 13, watchOS 6, *) {
3838
print(getPAT(Int.self))
3939
} else {
4040
print("i'm getting too old for this sh")

test/ParseableInterface/Inputs/opaque-result-types-client.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func getAssocSubscriptType<T: AssocTypeInference>(_ x: T) -> T.AssocSubscript {
1313
struct MyFoo: Foo {}
1414
struct YourFoo: Foo {}
1515

16-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, *)
16+
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
1717
func someTypeIsTheSame() {
1818
var a = foo(0)
1919
a = foo(0)

0 commit comments

Comments
 (0)