22
33// MARK: - Valid declarations
44
5- @available ( macOS 12 . 0 , * )
6- @_backDeploy ( macOS 11 . 0 )
5+ @available ( macOS 11 . 0 , * )
6+ @_backDeploy ( macOS 12 . 0 )
77public func backDeployedTopLevelFunc( ) { }
88
99// FIXME(backDeploy): Availability macros should be supported
1010
1111public class TopLevelClass {
12- @available ( macOS 12 . 0 , * )
13- @_backDeploy ( macOS 11 . 0 )
12+ @available ( macOS 11 . 0 , * )
13+ @_backDeploy ( macOS 12 . 0 )
1414 public func backDeployedMemberFunc( ) { }
1515
1616 // FIXME(backDeploy): Computed properties should be supported
17- @available ( macOS 12 . 0 , * )
18- @_backDeploy ( macOS 11 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
17+ @available ( macOS 11 . 0 , * )
18+ @_backDeploy ( macOS 12 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
1919 public var backDeployedComputedProperty : Int { 98 }
2020
2121 // FIXME(backDeploy): Subscripts should be supported
22- @available ( macOS 12 . 0 , * )
23- @_backDeploy ( macOS 11 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
22+ @available ( macOS 11 . 0 , * )
23+ @_backDeploy ( macOS 12 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
2424 subscript( index: Int ) -> Int {
2525 get { return 1 }
2626 set ( newValue) { }
@@ -29,28 +29,28 @@ public class TopLevelClass {
2929
3030// MARK: - Unsupported declaration types
3131
32- @available ( macOS 12 . 0 , * )
33- @_backDeploy ( macOS 11 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
32+ @available ( macOS 11 . 0 , * )
33+ @_backDeploy ( macOS 12 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
3434public class CannotBackDeployClass {
35- @available ( macOS 12 . 0 , * )
36- @_backDeploy ( macOS 11 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
35+ @available ( macOS 11 . 0 , * )
36+ @_backDeploy ( macOS 12 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
3737 public var cannotBackDeploystoredProperty : Int = 83
3838}
3939
40- @available ( macOS 12 . 0 , * )
41- @_backDeploy ( macOS 11 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
40+ @available ( macOS 11 . 0 , * )
41+ @_backDeploy ( macOS 12 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
4242public struct CannotBackDeployStruct { }
4343
44- @available ( macOS 12 . 0 , * )
45- @_backDeploy ( macOS 11 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
44+ @available ( macOS 11 . 0 , * )
45+ @_backDeploy ( macOS 12 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
4646public enum CannotBackDeployEnum {
47- @available ( macOS 12 . 0 , * )
48- @_backDeploy ( macOS 11 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
47+ @available ( macOS 11 . 0 , * )
48+ @_backDeploy ( macOS 12 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
4949 case cannotBackDeployEnumCase
5050}
5151
52- @available ( macOS 12 . 0 , * )
53- @_backDeploy ( macOS 11 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
52+ @available ( macOS 11 . 0 , * )
53+ @_backDeploy ( macOS 12 . 0 ) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}}
5454public var cannotBackDeployTopLevelVar = 79
5555
5656// MARK: - Incompatible declarations
@@ -62,69 +62,69 @@ public var cannotBackDeployTopLevelVar = 79
6262
6363// MARK: - Attribute parsing
6464
65- @available ( macOS 12 . 0 , * )
66- @_backDeploy ( macOS 11 . 0 , unknownOS 1 . 0 ) // expected-warning {{unknown platform 'unknownOS' for attribute '@_backDeploy'}}
65+ @available ( macOS 11 . 0 , * )
66+ @_backDeploy ( macOS 12 . 0 , unknownOS 1 . 0 ) // expected-warning {{unknown platform 'unknownOS' for attribute '@_backDeploy'}}
6767public func unknownOSFunc( ) { }
6868
69- @available ( macOS 12 . 0 , * )
69+ @available ( macOS 11 . 0 , * )
7070@_backDeploy ( @) // expected-error {{expected platform in '@_backDeploy' attribute}}
7171public func badPlatformFunc1( ) { }
7272
73- @available ( macOS 12 . 0 , * )
73+ @available ( macOS 11 . 0 , * )
7474@_backDeploy ( @ 12.0 ) // expected-error {{expected platform in '@_backDeploy' attribute}}
7575public func badPlatformFunc2( ) { }
7676
77- @available ( macOS 12 . 0 , * )
77+ @available ( macOS 11 . 0 , * )
7878@_backDeploy ( macOS) // expected-error {{expected version number in '@_backDeploy' attribute}}
7979public func missingVersionFunc1( ) { }
8080
81- @available ( macOS 12 . 0 , * )
82- @_backDeploy ( macOS 11 . 0 , iOS) // expected-error {{expected version number in '@_backDeploy' attribute}}
81+ @available ( macOS 11 . 0 , * )
82+ @_backDeploy ( macOS 12 . 0 , iOS) // expected-error {{expected version number in '@_backDeploy' attribute}}
8383public func missingVersionFunc2( ) { }
8484
85- @available ( macOS 12 . 0 , * )
85+ @available ( macOS 11 . 0 , * )
8686@_backDeploy ( macOS, iOS) // expected-error 2{{expected version number in '@_backDeploy' attribute}}
8787public func missingVersionFunc3( ) { }
8888
89- @available ( macOS 12 . 0 , * )
90- @_backDeploy ( macOS 11 . 0 , iOS 14 . 0 , ) // expected-error {{unexpected ',' separator}}
89+ @available ( macOS 11 . 0 , * )
90+ @_backDeploy ( macOS 12 . 0 , iOS 14 . 0 , ) // expected-error {{unexpected ',' separator}}
9191public func unexpectedSeparatorFunc( ) { }
9292
93- @available ( macOS 12 . 0 , * )
94- @_backDeploy ( macOS 11 . 0 . 1 ) // expected-warning {{'@_backDeploy' only uses major and minor version number}}
93+ @available ( macOS 11 . 0 , * )
94+ @_backDeploy ( macOS 12 . 0 . 1 ) // expected-warning {{'@_backDeploy' only uses major and minor version number}}
9595public func patchVersionFunc( ) { }
9696
97- @available ( macOS 12 . 0 , * )
98- @_backDeploy ( macOS 11 . 0 , * 9.0 ) // expected-warning {{* as platform name has no effect in '@_backDeploy' attribute}}
97+ @available ( macOS 11 . 0 , * )
98+ @_backDeploy ( macOS 12 . 0 , * 9.0 ) // expected-warning {{* as platform name has no effect in '@_backDeploy' attribute}}
9999public func wildcardWithVersionFunc( ) { }
100100
101- @available ( macOS 12 . 0 , * )
102- @_backDeploy ( macOS 11 . 0 , * ) // expected-warning {{* as platform name has no effect in '@_backDeploy' attribute}}
101+ @available ( macOS 11 . 0 , * )
102+ @_backDeploy ( macOS 12 . 0 , * ) // expected-warning {{* as platform name has no effect in '@_backDeploy' attribute}}
103103public func trailingWildcardFunc( ) { }
104104
105- @available ( macOS 12 . 0 , * )
106- @_backDeploy ( macOS 11 . 0 , * , iOS 14 . 0 ) // expected-warning {{* as platform name has no effect in '@_backDeploy' attribute}}
105+ @available ( macOS 11 . 0 , * )
106+ @_backDeploy ( macOS 12 . 0 , * , iOS 14 . 0 ) // expected-warning {{* as platform name has no effect in '@_backDeploy' attribute}}
107107public func embeddedWildcardFunc( ) { }
108108
109109// FIXME(backDeploy): Expect error for duplicate platforms in same attribute
110- @available ( macOS 12 . 0 , * )
111- @_backDeploy ( macOS 11 . 0 , macOS 10 . 0 )
110+ @available ( macOS 11 . 0 , * )
111+ @_backDeploy ( macOS 12 . 0 , macOS 13 . 0 )
112112public func duplicatePlatformsFunc1( ) { }
113113
114114// FIXME(backDeploy): Expect error for duplicate platforms accross multiple attributes
115- @available ( macOS 12 . 0 , * )
116- @_backDeploy ( macOS 11 . 0 )
117- @_backDeploy ( macOS 10 . 0 )
115+ @available ( macOS 11 . 0 , * )
116+ @_backDeploy ( macOS 12 . 0 )
117+ @_backDeploy ( macOS 13 . 0 )
118118public func duplicatePlatformsFunc2( ) { }
119119
120- @available ( macOS 12 . 0 , * )
120+ @available ( macOS 11 . 0 , * )
121121@_backDeploy ( ) // expected-error {{expected at least one platform version in '@_backDeploy' attribute}}
122122public func zeroPlatformVersionsFunc( ) { }
123123
124- @available ( macOS 12 . 0 , * )
124+ @available ( macOS 11 . 0 , * )
125125@_backDeploy // expected-error {{expected '(' in '_backDeploy' attribute}}
126126public func expectedLeftParenFunc( ) { }
127127
128- @available ( macOS 12 . 0 , * )
129- @_backDeploy ( macOS 11 . 0 // expected-note {{to match this opening '('}}
128+ @available ( macOS 11 . 0 , * )
129+ @_backDeploy ( macOS 12 . 0 // expected-note {{to match this opening '('}}
130130public func expectedRightParenFunc( ) { } // expected-error {{expected ')' in '@_backDeploy' argument list}}
0 commit comments