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
[Sema] When walking a member reference expression, if the member is provided by a protocol conformance be sure to check the availability of conformance.
Expands conformance availability tests to include test cases covering member references and key paths.
Resolves rdar://87795154.
takesHorse(x) // expected-error {{conformance of 'HasUnavailableConformance6' to 'Horse' is unavailable: This conformance is bad}}
123
144
x.giddyUp() // expected-error {{conformance of 'HasUnavailableConformance6' to 'Horse' is unavailable: This conformance is bad}}
145
+
_ = x.isGalloping // expected-error {{conformance of 'HasUnavailableConformance6' to 'Horse' is unavailable: This conformance is bad}}
146
+
_ =x[keyPath: \.isGalloping] // expected-error {{conformance of 'HasUnavailableConformance6' to 'Horse' is unavailable: This conformance is bad}}
124
147
_ = UsesHorse<HasUnavailableConformance6>.self // expected-error {{conformance of 'HasUnavailableConformance6' to 'Horse' is unavailable: This conformance is bad}}
takesHorse(x) // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}
154
181
x.giddyUp() // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}
182
+
_ = x.isGalloping // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}
183
+
_ =x[keyPath: \.isGalloping] // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}
155
184
_ = UsesHorse<HasDeprecatedConformance2>.self // expected-warning {{conformance of 'HasDeprecatedConformance2' to 'Horse' is deprecated: This conformance is deprecated}}
takesHorse(x) // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}
173
204
x.giddyUp() // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}
205
+
_ = x.isGalloping // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}
206
+
_ =x[keyPath: \.isGalloping] // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}
174
207
_ = UsesHorse<HasDeprecatedConformance3>.self // expected-warning {{conformance of 'HasDeprecatedConformance3' to 'Horse' was deprecated in macOS 10.8}}
// in test/Sema/conformance_availability_warn.swift for the same example
197
232
// but without this flag.
198
233
199
-
func passAvailableConformance1(x:HasAvailableConformance1){ // expected-note 3{{add @available attribute to enclosing global function}}
234
+
func passAvailableConformance1(x:HasAvailableConformance1){ // expected-note 5{{add @available attribute to enclosing global function}}
200
235
takesHorse(x) // expected-error {{conformance of 'HasAvailableConformance1' to 'Horse' is only available in macOS 100 or newer}}
201
236
// expected-note@-1 {{add 'if #available' version check}}
202
237
203
238
x.giddyUp() // expected-error {{conformance of 'HasAvailableConformance1' to 'Horse' is only available in macOS 100 or newer}}
204
239
// expected-note@-1 {{add 'if #available' version check}}
205
240
241
+
_ = x.isGalloping // expected-error {{conformance of 'HasAvailableConformance1' to 'Horse' is only available in macOS 100 or newer}}
242
+
// expected-note@-1 {{add 'if #available' version check}}
243
+
244
+
_ =x[keyPath: \.isGalloping] // expected-error {{conformance of 'HasAvailableConformance1' to 'Horse' is only available in macOS 100 or newer}}
245
+
// expected-note@-1 {{add 'if #available' version check}}
246
+
206
247
_ = UsesHorse<HasAvailableConformance1>.self // expected-error {{conformance of 'HasAvailableConformance1' to 'Horse' is only available in macOS 100 or newer}}
207
248
// expected-note@-1 {{add 'if #available' version check}}
// test case in test/Sema/conformance_availability.swift for the same
23
24
// example but with this flag.
24
25
25
-
func passAvailableConformance1(x:HasAvailableConformance1){ // expected-note 3{{add @available attribute to enclosing global function}}
26
+
func passAvailableConformance1(x:HasAvailableConformance1){ // expected-note 5{{add @available attribute to enclosing global function}}
26
27
takesHorse(x) // expected-warning {{conformance of 'HasAvailableConformance1' to 'Horse' is only available in macOS 100 or newer}}
27
28
// expected-note@-1 {{add 'if #available' version check}}
28
29
29
30
x.giddyUp() // expected-warning {{conformance of 'HasAvailableConformance1' to 'Horse' is only available in macOS 100 or newer}}
30
31
// expected-note@-1 {{add 'if #available' version check}}
32
+
33
+
_ = x.isGalloping // expected-warning {{conformance of 'HasAvailableConformance1' to 'Horse' is only available in macOS 100 or newer}}
34
+
// expected-note@-1 {{add 'if #available' version check}}
35
+
36
+
_ =x[keyPath: \.isGalloping] // expected-warning {{conformance of 'HasAvailableConformance1' to 'Horse' is only available in macOS 100 or newer}}
37
+
// expected-note@-1 {{add 'if #available' version check}}
31
38
32
39
_ = UsesHorse<HasAvailableConformance1>.self // expected-warning {{conformance of 'HasAvailableConformance1' to 'Horse' is only available in macOS 100 or newer}}
33
40
// expected-note@-1 {{add 'if #available' version check}}
0 commit comments