Skip to content

Commit 640c9b0

Browse files
committed
NFC: Update @_backDeploy tests to remove @available attributes where possible.
1 parent 1436c75 commit 640c9b0

12 files changed

+7
-81
lines changed

test/ModuleInterface/back-deploy-attr.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,26 @@
88
public struct TopLevelStruct {
99
// CHECK: @_backDeploy(before: macOS 12.0)
1010
// CHECK: public func backDeployedFunc_SinglePlatform() -> Swift.Int { return 42 }
11-
@available(macOS 11.0, *)
1211
@_backDeploy(before: macOS 12.0)
1312
public func backDeployedFunc_SinglePlatform() -> Int { return 42 }
1413

1514
// CHECK: @_backDeploy(before: macOS 12.0)
1615
// CHECK: @_backDeploy(before: iOS 15.0)
1716
// CHECK: public func backDeployedFunc_MultiPlatform() -> Swift.Int { return 43 }
18-
@available(macOS 11.0, iOS 14.0, *)
1917
@_backDeploy(before: macOS 12.0, iOS 15.0)
2018
public func backDeployedFunc_MultiPlatform() -> Int { return 43 }
2119

2220
// CHECK: @_backDeploy(before: macOS 12.0)
2321
// CHECK: public var backDeployedComputedProperty: Swift.Int {
2422
// CHECK: get { 44 }
2523
// CHECK: }
26-
@available(macOS 11.0, *)
2724
@_backDeploy(before: macOS 12.0)
2825
public var backDeployedComputedProperty: Int { 44 }
2926

3027
// CHECK: @_backDeploy(before: macOS 12.0)
3128
// CHECK: public var backDeployedPropertyWithAccessors: Swift.Int {
3229
// CHECK: get { 45 }
3330
// CHECK: }
34-
@available(macOS 11.0, *)
3531
@_backDeploy(before: macOS 12.0)
3632
public var backDeployedPropertyWithAccessors: Int {
3733
get { 45 }
@@ -41,7 +37,6 @@ public struct TopLevelStruct {
4137
// CHECK: public subscript(index: Swift.Int) -> Swift.Int {
4238
// CHECK: get { 46 }
4339
// CHECK: }
44-
@available(macOS 11.0, *)
4540
@_backDeploy(before: macOS 12.0)
4641
public subscript(index: Int) -> Int {
4742
get { 46 }
@@ -50,21 +45,18 @@ public struct TopLevelStruct {
5045

5146
// CHECK: @_backDeploy(before: macOS 12.0)
5247
// CHECK: public func backDeployTopLevelFunc1() -> Swift.Int { return 47 }
53-
@available(macOS 11.0, *)
5448
@_backDeploy(before: macOS 12.0)
5549
public func backDeployTopLevelFunc1() -> Int { return 47 }
5650

5751
// MARK: - Availability macros
5852

5953
// CHECK: @_backDeploy(before: macOS 12.1)
6054
// CHECK: public func backDeployTopLevelFunc2() -> Swift.Int { return 48 }
61-
@available(macOS 11.0, *)
6255
@_backDeploy(before: _macOS12_1)
6356
public func backDeployTopLevelFunc2() -> Int { return 48 }
6457

6558
// CHECK: @_backDeploy(before: macOS 12.1)
6659
// CHECK: @_backDeploy(before: iOS 15.1)
6760
// CHECK: public func backDeployTopLevelFunc3() -> Swift.Int { return 49 }
68-
@available(macOS 11.0, iOS 14.0, *)
6961
@_backDeploy(before: _myProject 1.0)
7062
public func backDeployTopLevelFunc3() -> Int { return 49 }

test/SILGen/back_deploy_attribute_accessor.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
// REQUIRES: OS=macosx
77

8-
@available(macOS 10.50, *)
98
public struct TopLevelStruct {
109
// -- Fallback definition for TopLevelStruct.property.getter
1110
// CHECK-LABEL: sil non_abi [serialized] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvgTwB : $@convention(method) (TopLevelStruct) -> TopLevelStruct
@@ -37,14 +36,12 @@ public struct TopLevelStruct {
3736

3837
// -- Original definition of TopLevelStruct.property.getter
3938
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvg : $@convention(method) (TopLevelStruct) -> TopLevelStruct
40-
@available(macOS 10.51, *)
4139
@_backDeploy(before: macOS 10.52)
4240
public var property: TopLevelStruct { self }
4341
}
4442

45-
// CHECK-LABEL: sil hidden [available 10.51] [ossa] @$s11back_deploy6calleryyAA14TopLevelStructVF : $@convention(thin) (TopLevelStruct) -> ()
43+
// CHECK-LABEL: sil hidden [ossa] @$s11back_deploy6calleryyAA14TopLevelStructVF : $@convention(thin) (TopLevelStruct) -> ()
4644
// CHECK: bb0([[STRUCT_ARG:%.*]] : $TopLevelStruct):
47-
@available(macOS 10.51, *)
4845
func caller(_ s: TopLevelStruct) {
4946
// -- Verify the thunk is called
5047
// CHECK: {{%.*}} = function_ref @$s11back_deploy14TopLevelStructV8propertyACvgTwb : $@convention(method) (TopLevelStruct) -> TopLevelStruct

test/SILGen/back_deploy_attribute_accessor_coroutine.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
// REQUIRES: OS=macosx
77

8-
@available(macOS 10.50, *)
98
public struct TopLevelStruct {
109
// -- Fallback definition for TopLevelStruct.property.read
1110
// CHECK-LABEL: sil non_abi [serialized] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvrTwB : $@yield_once @convention(method) (TopLevelStruct) -> @yields TopLevelStruct
@@ -64,16 +63,14 @@ public struct TopLevelStruct {
6463

6564
// -- Original definition of TopLevelStruct.property.read
6665
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvr : $@yield_once @convention(method) (TopLevelStruct) -> @yields TopLevelStruct
67-
@available(macOS 10.51, *)
6866
@_backDeploy(before: macOS 10.52)
6967
public var property: TopLevelStruct {
7068
_read { yield self }
7169
}
7270
}
7371

74-
// CHECK-LABEL: sil hidden [available 10.51] [ossa] @$s11back_deploy6calleryyAA14TopLevelStructVF : $@convention(thin) (TopLevelStruct) -> ()
72+
// CHECK-LABEL: sil hidden [ossa] @$s11back_deploy6calleryyAA14TopLevelStructVF : $@convention(thin) (TopLevelStruct) -> ()
7573
// CHECK: bb0([[STRUCT_ARG:%.*]] : $TopLevelStruct):
76-
@available(macOS 10.51, *)
7774
func caller(_ s: TopLevelStruct) {
7875
// -- Verify the thunk is called
7976
// CHECK: {{%.*}} = function_ref @$s11back_deploy14TopLevelStructV8propertyACvrTwb : $@yield_once @convention(method) (TopLevelStruct) -> @yields TopLevelStruct

test/SILGen/back_deploy_attribute_async_func.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// REQUIRES: OS=macosx
77
// REQUIRES: concurrency
88

9-
@available(macOS 10.51, *)
109
@usableFromInline func otherFunc() async {}
1110

1211
// -- Fallback definition of asyncFunc()
@@ -43,14 +42,12 @@
4342

4443
// -- Original definition of trivialFunc()
4544
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy9asyncFuncyyYaF : $@convention(thin) @async () -> ()
46-
@available(macOS 10.51, *)
4745
@_backDeploy(before: macOS 10.52)
4846
public func asyncFunc() async {
4947
await otherFunc()
5048
}
5149

52-
// CHECK-LABEL: sil hidden [available 10.51] [ossa] @$s11back_deploy6calleryyYaF : $@convention(thin) @async () -> ()
53-
@available(macOS 10.51, *)
50+
// CHECK-LABEL: sil hidden [ossa] @$s11back_deploy6calleryyYaF : $@convention(thin) @async () -> ()
5451
func caller() async {
5552
// -- Verify the thunk is called
5653
// CHECK: {{%.*}} = function_ref @$s11back_deploy9asyncFuncyyYaFTwb : $@convention(thin) @async () -> ()

test/SILGen/back_deploy_attribute_func.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737

3838
// -- Original definition of trivialFunc()
3939
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy11trivialFuncyyF : $@convention(thin) () -> ()
40-
@available(macOS 10.51, *)
4140
@_backDeploy(before: macOS 10.52)
4241
public func trivialFunc() {}
4342

@@ -72,14 +71,12 @@ public func trivialFunc() {}
7271

7372
// -- Original definition of isNumber(_:)
7473
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy8isNumberySbSiF : $@convention(thin) (Int) -> Bool
75-
@available(macOS 10.51, *)
7674
@_backDeploy(before: macOS 10.52)
7775
public func isNumber(_ x: Int) -> Bool {
7876
return true
7977
}
8078

81-
// CHECK-LABEL: sil hidden [available 10.51] [ossa] @$s11back_deploy6calleryyF : $@convention(thin) () -> ()
82-
@available(macOS 10.51, *)
79+
// CHECK-LABEL: sil hidden [ossa] @$s11back_deploy6calleryyF : $@convention(thin) () -> ()
8380
func caller() {
8481
// -- Verify the thunk is called
8582
// CHECK: {{%.*}} = function_ref @$s11back_deploy11trivialFuncyyFTwb : $@convention(thin) () -> ()

test/SILGen/back_deploy_attribute_generic_func.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@
3838

3939
// -- Original definition of genericFunc()
4040
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy11genericFuncyxxlF : $@convention(thin) <T> (@in_guaranteed T) -> @out T
41-
@available(macOS 10.51, *)
4241
@_backDeploy(before: macOS 10.52)
4342
public func genericFunc<T>(_ t: T) -> T {
4443
return t
4544
}
4645

47-
// CHECK-LABEL: sil hidden [available 10.51] [ossa] @$s11back_deploy6calleryyF : $@convention(thin) () -> ()
48-
@available(macOS 10.51, *)
46+
// CHECK-LABEL: sil hidden [ossa] @$s11back_deploy6calleryyF : $@convention(thin) () -> ()
4947
func caller() {
5048
// -- Verify the thunk is called
5149
// CHECK: {{%.*}} = function_ref @$s11back_deploy11genericFuncyxxlFTwb : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> @out τ_0_0

test/SILGen/back_deploy_attribute_struct_method.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
// REQUIRES: OS=macosx
77

8-
@available(macOS 10.50, *)
98
public struct TopLevelStruct {
109
// -- Fallback definition for TopLevelStruct.trivialMethod()
1110
// CHECK-LABEL: sil non_abi [serialized] [ossa] @$s11back_deploy14TopLevelStructV13trivialMethodyyFTwB : $@convention(method) (TopLevelStruct) -> ()
@@ -39,14 +38,12 @@ public struct TopLevelStruct {
3938

4039
// -- Original definition of TopLevelStruct.trivialMethod()
4140
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy14TopLevelStructV13trivialMethodyyF : $@convention(method) (TopLevelStruct) -> ()
42-
@available(macOS 10.51, *)
4341
@_backDeploy(before: macOS 10.52)
4442
public func trivialMethod() {}
4543
}
4644

47-
// CHECK-LABEL: sil hidden [available 10.51] [ossa] @$s11back_deploy6calleryyAA14TopLevelStructVF : $@convention(thin) (TopLevelStruct) -> ()
45+
// CHECK-LABEL: sil hidden [ossa] @$s11back_deploy6calleryyAA14TopLevelStructVF : $@convention(thin) (TopLevelStruct) -> ()
4846
// CHECK: bb0([[STRUCT_ARG:%.*]] : $TopLevelStruct):
49-
@available(macOS 10.51, *)
5047
func caller(_ s: TopLevelStruct) {
5148
// -- Verify the thunk is called
5249
// CHECK: {{%.*}} = function_ref @$s11back_deploy14TopLevelStructV13trivialMethodyyFTwb : $@convention(method) (TopLevelStruct) -> ()

test/SILGen/back_deploy_attribute_throwing_func.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,10 @@
5050

5151
// -- Original definition of throwingFunc()
5252
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy12throwingFuncyyKF : $@convention(thin) () -> @error any Error
53-
@available(macOS 10.51, *)
5453
@_backDeploy(before: macOS 10.52)
5554
public func throwingFunc() throws {}
5655

57-
// CHECK-LABEL: sil hidden [available 10.51] [ossa] @$s11back_deploy6calleryyKF : $@convention(thin) () -> @error any Error
58-
@available(macOS 10.51, *)
56+
// CHECK-LABEL: sil hidden [ossa] @$s11back_deploy6calleryyKF : $@convention(thin) () -> @error any Error
5957
func caller() throws {
6058
// -- Verify the thunk is called
6159
// CHECK: {{%.*}} = function_ref @$s11back_deploy12throwingFuncyyKFTwb : $@convention(thin) () -> @error any Error

test/Sema/availability_define.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ public func forbidMacrosInInlinableCode1() {
9696
}
9797
}
9898

99-
@available(_iOS8Aligned, *)
10099
@_backDeploy(before: _iOS9Aligned)
101100
public func forbidMacrosInInlinableCode2() {
102101
if #available(_iOS9Aligned, *) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %target-swift-frontend -parse-as-library -enable-library-evolution -emit-module -module-name Test -experimental-skip-non-inlinable-function-bodies %s
22

3-
@available(SwiftStdlib 5.6, *)
43
@_backDeploy(before: SwiftStdlib 5.7)
54
public func foo() {}

0 commit comments

Comments
 (0)