You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/Sema/availability_swiftui.swift
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -13,3 +13,4 @@ class AnyColorBox: LessAvailable {} // Ok, exception specifically for AnyColorBo
13
13
@available(macOS 10.15,*)
14
14
@usableFromInline
15
15
classOtherClass:LessAvailable{} // expected-error {{'LessAvailable' is only available in macOS 11 or newer; clients of 'SwiftUI' may have a lower deployment target}}
16
+
// expected-note @-1 {{update @available attribute for macOS from '10.15' to '11' to meet the requirements of 'LessAvailable'}} {{13:18-23=11}}
// Functions with annotations should refine their bodies.
43
43
@available(OSX, introduced:10.51)
44
44
func functionAvailableOn10_51(){
45
+
// expected-note@-1 {{update @available attribute for macOS from '10.51' to '10.52' to meet the requirements of 'globalFuncAvailableOn10_52'}} {{43:29-34=10.52}}
45
46
let _:Int=globalFuncAvailableOn10_9()
46
47
let _:Int=globalFuncAvailableOn10_51()
47
48
@@ -324,10 +325,11 @@ class ClassWithPotentiallyUnavailableProperties {
324
325
325
326
@available(OSX, introduced:10.9)
326
327
varavailableOn10_9Computed:Int{
328
+
// expected-note@-1 {{update @available attribute for macOS from '10.9' to '10.51' to meet the requirements of 'availableOn10_51Stored'}} {{326:31-35=10.51}}
327
329
get{
328
330
let _:Int= availableOn10_51Stored // expected-error {{'availableOn10_51Stored' is only available in macOS 10.51 or newer}}
329
331
// expected-note@-1 {{add 'if #available' version check}}
330
-
332
+
331
333
if #available(OSX 10.51,*){
332
334
let _:Int= availableOn10_51Stored
333
335
}
@@ -406,6 +408,7 @@ class ClassWithPotentiallyUnavailableProperties {
406
408
407
409
@available(OSX, introduced:10.51)
408
410
classClassWithReferencesInInitializers{
411
+
// expected-note@-1 2 {{update @available attribute for macOS from '10.51' to '10.52' to meet the requirements of 'globalFuncAvailableOn10_52'}} {{409:29-34=10.52}}
varpropWithInitializer10_52:Int=globalFuncAvailableOn10_52() // expected-error {{'globalFuncAvailableOn10_52()' is only available in macOS 10.52 or newer}}
@@ -522,6 +525,8 @@ enum EnumIntroducedOn10_52 {
522
525
523
526
@available(OSX, introduced:10.51)
524
527
enumCompassPoint{
528
+
// expected-note@-1 3 {{update @available attribute for macOS from '10.51' to '10.52' to meet the requirements of 'EnumIntroducedOn10_52'}} {{526:29-34=10.52}}
529
+
525
530
case North
526
531
case South
527
532
case East
@@ -542,7 +547,7 @@ enum CompassPoint {
542
547
case WithPotentiallyUnavailablePayload(p :EnumIntroducedOn10_52) // expected-error {{'EnumIntroducedOn10_52' is only available in macOS 10.52 or newer}}
543
548
544
549
case WithPotentiallyUnavailablePayload1(p :EnumIntroducedOn10_52), WithPotentiallyUnavailablePayload2(p :EnumIntroducedOn10_52) // expected-error 2{{'EnumIntroducedOn10_52' is only available in macOS 10.52 or newer}}
545
-
550
+
546
551
@available(OSX, unavailable)
547
552
case WithPotentiallyUnavailablePayload3(p :EnumIntroducedOn10_52)
548
553
}
@@ -876,20 +881,21 @@ class SubWithLargerMemberAvailability : SuperWithLimitedMemberAvailability {
876
881
// expected-note@-1 2{{add @available attribute to enclosing class}}
877
882
@available(OSX, introduced:10.9)
878
883
overridefunc someMethod(){
884
+
// expected-note@-1 {{update @available attribute for macOS from '10.9' to '10.51' to meet the requirements of 'someMethod'}} {{882:31-35=10.51}}
879
885
super.someMethod() // expected-error {{'someMethod()' is only available in macOS 10.51 or newer}}
880
886
// expected-note@-1 {{add 'if #available' version check}}
881
-
887
+
882
888
if #available(OSX 10.51,*){
883
889
super.someMethod()
884
890
}
885
891
}
886
892
887
893
@available(OSX, introduced:10.9)
888
894
overridevarsomeProperty:Int{
889
-
get{
895
+
// expected-note@-1 {{update @available attribute for macOS from '10.9' to '10.51' to meet the requirements of 'someProperty'}} {{893:31-35=10.51}}
896
+
get{
890
897
let _ = super.someProperty // expected-error {{'someProperty' is only available in macOS 10.51 or newer}}
891
-
// expected-note@-1 {{add 'if #available' version check}}
892
-
898
+
// expected-note@-1 {{add 'if #available' version check}}
protocolProtocolAvailableOn10_9InheritingFromProtocolAvailableOn10_51:ProtocolAvailableOn10_51{ // expected-error {{'ProtocolAvailableOn10_51' is only available in macOS 10.51 or newer}}
970
+
// expected-note@-1 {{update @available attribute for macOS from '10.9' to '10.51' to meet the requirements of 'ProtocolAvailableOn10_51'}} {{968:29-33=10.51}}
classSubclassAvailableOn10_9OfClassAvailableOn10_51:ClassAvailableOn10_51{ // expected-error {{'ClassAvailableOn10_51' is only available in macOS 10.51 or newer}}
983
+
// expected-note@-1 {{update @available attribute for macOS from '10.9' to '10.51' to meet the requirements of 'ClassAvailableOn10_51'}} {{981:29-33=10.51}}
classSubclassAvailableOn10_9OfClassAvailableOn10_51AlsoAdoptingProtocolAvailableOn10_51:ClassAvailableOn10_51,ProtocolAvailableOn10_51{ // expected-error {{'ClassAvailableOn10_51' is only available in macOS 10.51 or newer}}
1008
+
// expected-note@-1 {{update @available attribute for macOS from '10.9' to '10.51' to meet the requirements of 'ClassAvailableOn10_51'}} {{1006:29-33=10.51}}
1000
1009
}
1001
1010
1002
1011
classSomeGenericClass<T>{}
1003
1012
1004
1013
@available(OSX, introduced:10.9)
1005
1014
classSubclassAvailableOn10_9OfSomeGenericClassOfProtocolAvailableOn10_51:SomeGenericClass<ProtocolAvailableOn10_51>{ // expected-error {{'ProtocolAvailableOn10_51' is only available in macOS 10.51 or newer}}
1015
+
// expected-note@-1 {{update @available attribute for macOS from '10.9' to '10.51' to meet the requirements of 'ProtocolAvailableOn10_51'}} {{1013:29-33=10.51}}
// expected-note@-1 {{update @available attribute for macOS from '10.51' to '10.52' to meet the requirements of 'globalFuncAvailableOn10_52'}} {{1060:29-34=10.52}}
1052
1063
func m(){
1053
1064
// expected-note@-1 {{add @available attribute to enclosing instance method}}
1054
1065
let _ =globalFuncAvailableOn10_51()
@@ -1653,6 +1664,7 @@ class ClassWithShortFormAvailableOn10_54 {
1653
1664
1654
1665
@available(OSX 10.9,*)
1655
1666
func funcWithShortFormAvailableOn10_9(){
1667
+
// expected-note@-1 {{update @available attribute for macOS from '10.9' to '10.51' to meet the requirements of 'ClassWithShortFormAvailableOn10_51'}} {{1665:16-20=10.51}}
1656
1668
let _ =ClassWithShortFormAvailableOn10_51() // expected-error {{'ClassWithShortFormAvailableOn10_51' is only available in macOS 10.51 or newer}}
1657
1669
// expected-note@-1 {{add 'if #available' version check}}
// expected-note@-1 {{update @available attribute for macOS from '10.52' to '10.54' to meet the requirements of 'ClassWithShortFormAvailableOn10_54'}} {{1698:16-21=10.54}}
1688
1701
let _ =ClassWithShortFormAvailableOn10_53()
1689
1702
1690
1703
let _ =ClassWithShortFormAvailableOn10_54() // expected-error {{'ClassWithShortFormAvailableOn10_54' is only available in macOS 10.54 or newer}}
Copy file name to clipboardExpand all lines: test/Sema/availability_versions_multi.swift
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,11 @@ let ignored3: Int = globalAvailableOn99_52 // expected-error {{'globalAvailableO
25
25
26
26
@available(OSX, introduced:99.51)
27
27
func useFromOtherOn99_51(){
28
+
// expected-note@-1 {{update @available attribute for macOS from '99.51' to '99.52' to meet the requirements of 'returns99_52Introduced99_52'}} {{26:29-34=99.52}}
29
+
// expected-note@-2 {{update @available attribute for macOS from '99.51' to '99.52' to meet the requirements of 'OtherIntroduced99_52'}} {{26:29-34=99.52}}
30
+
// expected-note@-3 {{update @available attribute for macOS from '99.51' to '99.52' to meet the requirements of 'extensionMethodOnOtherIntroduced99_51AvailableOn99_52'}} {{26:29-34=99.52}}
31
+
// expected-note@-4 {{update @available attribute for macOS from '99.51' to '99.52' to meet the requirements of 'NestedIntroduced99_52'}} {{26:29-34=99.52}}
32
+
28
33
// This will trigger validation of OtherIntroduced99_51 in
29
34
// in availability_multi_other.swift
30
35
leto99_51=OtherIntroduced99_51()
@@ -49,6 +54,7 @@ func useFromOtherOn99_51() {
49
54
50
55
@available(OSX, introduced:99.52)
51
56
func useFromOtherOn99_52(){
57
+
// expected-note@-1 {{update @available attribute for macOS from '99.52' to '99.53' to meet the requirements of 'returns99_53'}} {{55:29-34=99.53}}
Copy file name to clipboardExpand all lines: test/attr/ApplicationMain/attr_main_struct_available_future.swift
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
@main // expected-error {{'main()' is only available in macOS 10.99 or newer}}
6
6
@available(OSX 10.0,*)
7
-
structEntryPoint{
7
+
structEntryPoint{ // expected-note {{update @available attribute for macOS from '10.0' to '10.99' to meet the requirements of '@main'}} {{6:16-20=10.99}}
Copy file name to clipboardExpand all lines: test/attr/attr_availability_osx.swift
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -115,7 +115,7 @@ extension TestStruct {
115
115
}
116
116
117
117
@available(macOS 10.11,*)
118
-
func testMemberAvailability(){
118
+
func testMemberAvailability(){ // expected-note {{update @available attribute for macOS from '10.11' to '10.12' to meet the requirements of 'doFourthThing'}} {{117:18-23=10.12}}
119
119
TestStruct().doTheThing() // expected-error {{'doTheThing()' is unavailable}}
120
120
TestStruct().doAnotherThing() // expected-error {{'doAnotherThing()' is unavailable}}
121
121
TestStruct().doThirdThing() // expected-error {{'doThirdThing()' is unavailable}}
// expected-error@-1 {{'FooForDefineAvailability()' is only available in macOS 10.15 or newer}}
10
+
// expected-note@-2 {{add 'if #available' version check}}
11
+
}
12
+
13
+
@available(*, unavailable)
14
+
func FooForUnavailable(){} // expected-note {{'FooForUnavailable()' has been explicitly marked unavailable here}}
15
+
16
+
func FooForUnavailableTest(){
17
+
FooForUnavailable()
18
+
// expected-error@-1 {{'FooForUnavailable()' is unavailable}}
19
+
}
20
+
21
+
@available(macOS, introduced:10.15)
22
+
func FooForAvailability(){}
23
+
24
+
@available(macOS, introduced:10.10)
25
+
func FooForAvailabilityTest(){
26
+
// expected-note@-1 {{update @available attribute for macOS from '10.10' to '10.15' to meet the requirements of 'FooForAvailability'}} {{24:31-36=10.15}}
27
+
FooForAvailability()
28
+
// expected-error@-1 {{'FooForAvailability()' is only available in macOS 10.15 or newer}}
29
+
// expected-note@-2 {{add 'if #available' version check}}
30
+
}
31
+
32
+
@available(macOS 10.15, iOS 13,*)
33
+
func FooForAvailability2(){
34
+
}
35
+
36
+
@available(macOS 10.10,*)
37
+
func FooForAvailability2Test(){
38
+
// expected-note@-1 {{update @available attribute for macOS from '10.10' to '10.15' to meet the requirements of 'FooForAvailability2'}} {{36:18-23=10.15}}
39
+
FooForAvailability2()
40
+
// expected-error@-1 {{'FooForAvailability2()' is only available in macOS 10.15 or newer}}
41
+
// expected-note@-2 {{add 'if #available' version check}}
42
+
}
43
+
44
+
@available(macOS 10.15,*)
45
+
func FooForUnavailable2(){}
46
+
47
+
@available(macOS, unavailable)
48
+
func FooForUnavailable2Test(){
49
+
FooForUnavailable2()
50
+
// expected-error@-1 {{'FooForUnavailable2()' is only available in macOS 10.15 or newer}}
51
+
// expected-note@-2 {{add 'if #available' version check}}
52
+
}
53
+
54
+
@available(macOS 10.15,*)
55
+
func FooForDeprecated(){}
56
+
57
+
@available(macOS, deprecated:12)
58
+
func FooForDeprecatedTest(){
59
+
FooForDeprecated()
60
+
// expected-error@-1 {{'FooForDeprecated()' is only available in macOS 10.15 or newer}}
61
+
// expected-note@-2 {{add 'if #available' version check}}
62
+
}
63
+
64
+
@available(*, deprecated)
65
+
func FooForDeprecatedTest2(){
66
+
FooForDeprecated()
67
+
// expected-error@-1 {{'FooForDeprecated()' is only available in macOS 10.15 or newer}}
68
+
// expected-note@-2 {{add 'if #available' version check}}
0 commit comments