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
publicstructS{ // expected-warning {{public declarations should have an availability attribute when building with -require-explicit-availability}}
8
7
publicfunc method(){}
@@ -52,6 +51,11 @@ extension S { // expected-warning {{public declarations should have an availabil
52
51
publicfunc warnForPublicMembers(){} // expected-warning {{public declarations should have an availability attribute when building with -require-explicit-availability}} {{3-3=@available(macOS 10.10, *)\n }}
53
52
}
54
53
54
+
@available(macOS 10.1,*)
55
+
extensionS{
56
+
publicfunc okWhenTheExtensionHasAttribute(){}
57
+
}
58
+
55
59
extensionS{
56
60
internalfunc dontWarnWithoutPublicMembers(){}
57
61
privatefunc dontWarnWithoutPublicMembers1(){}
@@ -68,3 +72,95 @@ open class OpenClass { } // expected-warning {{public declarations should have a
68
72
privateclassPrivateClass{}
69
73
70
74
extensionPrivateClass{}
75
+
76
+
@available(macOS 10.1,*)
77
+
publicprotocolPublicProtocol{}
78
+
79
+
@available(macOS 10.1,*)
80
+
extensionS:PublicProtocol{}
81
+
82
+
@_spi(SPIsAreOK)
83
+
publicfunc spiFunc(){}
84
+
85
+
@_spi(SPIsAreOK)
86
+
publicstructspiStruct{
87
+
publicfunc spiMethod(){}
88
+
}
89
+
90
+
extensionspiStruct{
91
+
publicfunc spiExtensionMethod(){}
92
+
}
93
+
94
+
publicvarpublicVar=S() // expected-warning {{public declarations should have an availability attribute when building with -require-explicit-availability}} {{1-1=@available(macOS 10.10, *)\n}}
95
+
96
+
@available(macOS 10.10,*)
97
+
publicvarpublicVarOk=S()
98
+
99
+
publicvar(a, b)=(S(),S()) // expected-warning {{public declarations should have an availability attribute when building with -require-explicit-availability}} {{1-1=@available(macOS 10.10, *)\n}}
100
+
101
+
@available(macOS 10.10,*)
102
+
publicvar(c, d)=(S(),S())
103
+
104
+
publicvar _ =S() // expected-error {{global variable declaration does not bind any variables}}
105
+
106
+
publicvarimplicitGet:S{ // expected-warning {{public declarations should have an availability attribute when building with -require-explicit-availability}} {{1-1=@available(macOS 10.10, *)\n}}
107
+
returnS()
108
+
}
109
+
110
+
@available(macOS 10.10,*)
111
+
publicvarimplicitGetOk:S{
112
+
returnS()
113
+
}
114
+
115
+
publicvarcomputed:S{ // expected-warning {{public declarations should have an availability attribute when building with -require-explicit-availability}} {{1-1=@available(macOS 10.10, *)\n}}
116
+
get{returnS()}
117
+
set{}
118
+
}
119
+
120
+
publicvarcomputedHalf:S{ // expected-warning {{public declarations should have an availability attribute when building with -require-explicit-availability}} {{1-1=@available(macOS 10.10, *)\n}}
121
+
@available(macOS 10.10,*)
122
+
get{returnS()}
123
+
set{}
124
+
}
125
+
126
+
// FIXME the following warning is not needed.
127
+
publicvarcomputedOk:S{ // expected-warning {{public declarations should have an availability attribute when building with -require-explicit-availability}} {{1-1=@available(macOS 10.10, *)\n}}
128
+
@available(macOS 10.10,*)
129
+
get{returnS()}
130
+
131
+
@available(macOS 10.10,*)
132
+
set{}
133
+
}
134
+
135
+
@available(macOS 10.10,*)
136
+
publicvarcomputedOk1:S{
137
+
get{returnS()}
138
+
set{}
139
+
}
140
+
141
+
publicclassSomeClass{ // expected-warning {{public declarations should have an availability attribute when building with -require-explicit-availability}} {{1-1=@available(macOS 10.10, *)\n}}
142
+
publicinit(){}
143
+
144
+
public subscript(index:String)->Int{
145
+
get{return42; }
146
+
set(newValue){}
147
+
}
148
+
}
149
+
150
+
extensionSomeClass{ // expected-warning {{public declarations should have an availability attribute when building with -require-explicit-availability}} {{1-1=@available(macOS 10.10, *)\n}}
151
+
publicconvenienceinit(s :S){} // expected-warning {{public declarations should have an availability attribute when building with -require-explicit-availability}} {{3-3=@available(macOS 10.10, *)\n }}
152
+
153
+
@available(macOS 10.10,*)
154
+
publicconvenienceinit(s :SomeClass){}
155
+
156
+
public subscript(index:Int)->Int{ // expected-warning {{public declarations should have an availability attribute when building with -require-explicit-availability}} {{3-3=@available(macOS 10.10, *)\n }}
0 commit comments