1
1
// RUN: %target-typecheck-verify-swift \
2
- // RUN: -define-availability "_iOS8Aligned :macOS 10.10 , iOS 8 .0" \
3
- // RUN: -define-availability "_iOS9Aligned :macOS 10.11 , iOS 9 .0" \
4
- // RUN: -define-availability "_iOS9 :iOS 9 .0" \
5
- // RUN: -define-availability "_macOS10_11 :macOS 10.11 " \
6
- // RUN: -define-availability "_myProject 1.0:macOS 10.11 " \
7
- // RUN: -define-availability "_myProject 2.5:macOS 10.12 "
2
+ // RUN: -define-availability "_iOS13Aligned :macOS 10.15 , iOS 13 .0" \
3
+ // RUN: -define-availability "_iOS14Aligned :macOS 11.0 , iOS 14 .0" \
4
+ // RUN: -define-availability "_iOS14 :iOS 14 .0" \
5
+ // RUN: -define-availability "_macOS11_0 :macOS 11.0 " \
6
+ // RUN: -define-availability "_myProject 1.0:macOS 11.0 " \
7
+ // RUN: -define-availability "_myProject 2.5:macOS 12.5 "
8
8
// REQUIRES: OS=macosx
9
9
10
- @available ( _iOS8Aligned , * )
11
- public func onMacOS10_10 ( ) { }
10
+ @available ( _iOS13Aligned , * )
11
+ public func onMacOS10_15 ( ) { }
12
12
13
- @available ( _iOS9Aligned , * )
14
- public func onMacOS10_11 ( ) { }
13
+ @available ( _iOS14Aligned , * )
14
+ public func onMacOS11_0 ( ) { }
15
15
16
- @available ( _iOS9 , _macOS10_11 , tvOS 11 . 0 , * )
16
+ @available ( _iOS14 , _macOS11_0 , tvOS 14 . 0 , * )
17
17
public func composed( ) { }
18
18
19
- @available ( _iOS8Aligned , * )
20
- @available ( macOS, deprecated: 10.10 )
19
+ @available ( _iOS13Aligned , * )
20
+ @available ( macOS, deprecated: 10.15 )
21
21
public func onMacOSDeprecated( ) { }
22
22
23
23
@available ( _myProject, * ) // expected-error {{expected declaration}}
@@ -42,57 +42,57 @@ public func brokenVersion() {}
42
42
// expected-error @-1 {{expected 'available' option such as 'unavailable', 'introduced', 'deprecated', 'obsoleted', 'message', or 'renamed'}}
43
43
public func unknownMacro( ) { }
44
44
45
- @available ( _iOS9 ) // expected-error {{must handle potential future platforms with '*'}}
45
+ @available ( _iOS14 ) // expected-error {{must handle potential future platforms with '*'}}
46
46
public func noOtherOSes( ) { }
47
47
48
- @available ( _iOS8Aligned , * )
48
+ @available ( _iOS13Aligned , * )
49
49
func client( ) {
50
- onMacOS10_10 ( )
51
- onMacOS10_11 ( ) // expected-error {{is only available in macOS 10.11 or newer}}
50
+ onMacOS10_15 ( )
51
+ onMacOS11_0 ( ) // expected-error {{is only available in macOS 11.0 or newer}}
52
52
// expected-note @-1 {{add 'if #available' version check}}
53
53
onMacOSDeprecated ( )
54
54
55
- if #available( _iOS9Aligned , * ) {
56
- onMacOS10_11 ( )
55
+ if #available( _iOS14Aligned , * ) {
56
+ onMacOS11_0 ( )
57
57
}
58
58
59
- if #unavailable( _iOS9Aligned ) {
60
- onMacOS10_11 ( ) // expected-error {{is only available in macOS 10.11 or newer}}
59
+ if #unavailable( _iOS14Aligned ) {
60
+ onMacOS11_0 ( ) // expected-error {{is only available in macOS 11.0 or newer}}
61
61
// expected-note @-1 {{add 'if #available' version check}}
62
62
} else {
63
- onMacOS10_11 ( )
63
+ onMacOS11_0 ( )
64
64
}
65
65
66
66
if #available( _unknownMacro, * ) { } // expected-error {{expected version number}}
67
67
}
68
68
69
69
@inlinable
70
70
public func forbidMacrosInInlinableCode( ) {
71
- if #available( _iOS9Aligned , * ) { } // expected-error {{availability macro cannot be used in an '@inlinable' function}}
72
- if #available( _iOS9 , _macOS10_11 , * ) { } // expected-error {{availability macro cannot be used in an '@inlinable' function}}
73
- if #available( iOS 9 . 0 , _macOS10_11 , tvOS 9 . 0 , * ) { } // expected-error {{availability macro cannot be used in an '@inlinable' function}}
74
- if #unavailable( _iOS9Aligned ) { } // expected-error {{availability macro cannot be used in an '@inlinable' function}}
75
- if #unavailable( _iOS9 , _macOS10_11 ) { } // expected-error {{availability macro cannot be used in an '@inlinable' function}}
76
- if #unavailable( iOS 9 . 0 , _macOS10_11 , tvOS 9 . 0 ) { } // expected-error {{availability macro cannot be used in an '@inlinable' function}}
71
+ if #available( _iOS14Aligned , * ) { } // expected-error {{availability macro cannot be used in an '@inlinable' function}}
72
+ if #available( _iOS14 , _macOS11_0 , * ) { } // expected-error {{availability macro cannot be used in an '@inlinable' function}}
73
+ if #available( iOS 14 . 0 , _macOS11_0 , tvOS 14 . 0 , * ) { } // expected-error {{availability macro cannot be used in an '@inlinable' function}}
74
+ if #unavailable( _iOS14Aligned ) { } // expected-error {{availability macro cannot be used in an '@inlinable' function}}
75
+ if #unavailable( _iOS14 , _macOS11_0 ) { } // expected-error {{availability macro cannot be used in an '@inlinable' function}}
76
+ if #unavailable( iOS 14 . 0 , _macOS11_0 , tvOS 14 . 0 ) { } // expected-error {{availability macro cannot be used in an '@inlinable' function}}
77
77
}
78
78
79
79
@_alwaysEmitIntoClient
80
80
public func forbidMacrosInInlinableCode1( ) {
81
- if #available( _iOS9Aligned , * ) { } // expected-error {{availability macro cannot be used in an '@_alwaysEmitIntoClient' function}}
82
- if #available( _iOS9 , _macOS10_11 , * ) { } // expected-error {{availability macro cannot be used in an '@_alwaysEmitIntoClient' function}}
83
- if #available( iOS 9 . 0 , _macOS10_11 , tvOS 9 . 0 , * ) { } // expected-error {{availability macro cannot be used in an '@_alwaysEmitIntoClient' function}}
84
- if #unavailable( _iOS9Aligned ) { } // expected-error {{availability macro cannot be used in an '@_alwaysEmitIntoClient' function}}
85
- if #unavailable( _iOS9 , _macOS10_11 ) { } // expected-error {{availability macro cannot be used in an '@_alwaysEmitIntoClient' function}}
86
- if #unavailable( iOS 9 . 0 , _macOS10_11 , tvOS 9 . 0 ) { } // expected-error {{availability macro cannot be used in an '@_alwaysEmitIntoClient' function}}
81
+ if #available( _iOS14Aligned , * ) { } // expected-error {{availability macro cannot be used in an '@_alwaysEmitIntoClient' function}}
82
+ if #available( _iOS14 , _macOS11_0 , * ) { } // expected-error {{availability macro cannot be used in an '@_alwaysEmitIntoClient' function}}
83
+ if #available( iOS 14 . 0 , _macOS11_0 , tvOS 14 . 0 , * ) { } // expected-error {{availability macro cannot be used in an '@_alwaysEmitIntoClient' function}}
84
+ if #unavailable( _iOS14Aligned ) { } // expected-error {{availability macro cannot be used in an '@_alwaysEmitIntoClient' function}}
85
+ if #unavailable( _iOS14 , _macOS11_0 ) { } // expected-error {{availability macro cannot be used in an '@_alwaysEmitIntoClient' function}}
86
+ if #unavailable( iOS 14 . 0 , _macOS11_0 , tvOS 14 . 0 ) { } // expected-error {{availability macro cannot be used in an '@_alwaysEmitIntoClient' function}}
87
87
}
88
88
89
- @available ( _iOS8Aligned , * )
90
- @_backDeploy ( before: _iOS9Aligned )
89
+ @available ( _iOS13Aligned , * )
90
+ @_backDeploy ( before: _iOS14Aligned )
91
91
public func forbidMacrosInInlinableCode2( ) {
92
- if #available( _iOS9Aligned , * ) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}}
93
- if #available( _iOS9 , _macOS10_11 , * ) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}}
94
- if #available( iOS 9 . 0 , _macOS10_11 , tvOS 9 . 0 , * ) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}}
95
- if #unavailable( _iOS9Aligned ) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}}
96
- if #unavailable( _iOS9 , _macOS10_11 ) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}}
97
- if #unavailable( iOS 9 . 0 , _macOS10_11 , tvOS 9 . 0 ) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}}
92
+ if #available( _iOS14Aligned , * ) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}}
93
+ if #available( _iOS14 , _macOS11_0 , * ) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}}
94
+ if #available( iOS 14 . 0 , _macOS11_0 , tvOS 14 . 0 , * ) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}}
95
+ if #unavailable( _iOS14Aligned ) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}}
96
+ if #unavailable( _iOS14 , _macOS11_0 ) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}}
97
+ if #unavailable( iOS 14 . 0 , _macOS11_0 , tvOS 14 . 0 ) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}}
98
98
}
0 commit comments