@@ -216,33 +216,33 @@ func passAvailableConformance1a(x: HasAvailableConformance1) {
216
216
217
217
// Associated conformance with unavailability
218
218
protocol Rider {
219
- associatedtype H : Horse
219
+ associatedtype H : Horse
220
220
}
221
221
222
222
struct AssocConformanceUnavailable : Rider {
223
223
// expected-error@-1 {{conformance of 'HasUnavailableConformance1' to 'Horse' is unavailable}}
224
224
// expected-note@-2 {{in associated type 'Self.H' (inferred as 'HasUnavailableConformance1')}}
225
- typealias H = HasUnavailableConformance1
225
+ typealias H = HasUnavailableConformance1
226
226
}
227
227
228
228
// Associated conformance with deprecation
229
229
struct AssocConformanceDeprecated : Rider {
230
230
// expected-warning@-1 {{conformance of 'HasDeprecatedConformance1' to 'Horse' is deprecated}}
231
231
// expected-note@-2 {{in associated type 'Self.H' (inferred as 'HasDeprecatedConformance1')}}
232
- typealias H = HasDeprecatedConformance1
232
+ typealias H = HasDeprecatedConformance1
233
233
}
234
234
235
235
// Associated conformance with availability
236
236
struct AssocConformanceAvailable1 : Rider {
237
237
// expected-error@-1 {{conformance of 'HasAvailableConformance1' to 'Horse' is only available in macOS 100 or newer}}
238
238
// expected-note@-2 {{in associated type 'Self.H' (inferred as 'HasAvailableConformance1')}}
239
239
// expected-note@-3 {{add @available attribute to enclosing struct}}
240
- typealias H = HasAvailableConformance1
240
+ typealias H = HasAvailableConformance1
241
241
}
242
242
243
243
@available ( macOS 100 , * )
244
244
struct AssocConformanceAvailable2 : Rider {
245
- typealias H = HasAvailableConformance1
245
+ typealias H = HasAvailableConformance1
246
246
}
247
247
248
248
struct AssocConformanceAvailable3 { }
@@ -251,25 +251,25 @@ extension AssocConformanceAvailable3 : Rider {
251
251
// expected-error@-1 {{conformance of 'HasAvailableConformance1' to 'Horse' is only available in macOS 100 or newer}}
252
252
// expected-note@-2 {{in associated type 'Self.H' (inferred as 'HasAvailableConformance1')}}
253
253
// expected-note@-3 {{add @available attribute to enclosing extension}}
254
- typealias H = HasAvailableConformance1
254
+ typealias H = HasAvailableConformance1
255
255
}
256
256
257
257
struct AssocConformanceAvailable4 { }
258
258
259
259
@available ( macOS 100 , * )
260
260
extension AssocConformanceAvailable4 : Rider {
261
- typealias H = HasAvailableConformance1
261
+ typealias H = HasAvailableConformance1
262
262
}
263
263
264
264
// Solution ranking should down-rank solutions involving unavailable conformances
265
265
protocol First { }
266
266
extension First {
267
- func doStuff< T> ( _: T ) -> Bool { }
267
+ func doStuff< T> ( _: T ) -> Bool { }
268
268
}
269
269
270
270
protocol Second { }
271
271
extension Second {
272
- func doStuff( _: Int ) -> Int { }
272
+ func doStuff( _: Int ) -> Int { }
273
273
}
274
274
275
275
struct ConformingType1 { }
@@ -281,16 +281,16 @@ extension ConformingType1 : Second {}
281
281
282
282
func usesConformingType1( _ c: ConformingType1 ) {
283
283
// We should pick First.doStuff() here, since Second.doStuff() is unavailable
284
- let result = c. doStuff ( 123 )
285
- let _: Bool = result
284
+ let result = c. doStuff ( 123 )
285
+ let _: Bool = result
286
286
}
287
287
288
288
@available ( macOS 100 , * )
289
289
func usesConformingType1a( _ c: ConformingType1 ) {
290
290
// We should pick Second.doStuff() here, since it is more specialized than
291
291
// First.doStuff()
292
- let result = c. doStuff ( 123 )
293
- let _: Int = result
292
+ let result = c. doStuff ( 123 )
293
+ let _: Int = result
294
294
}
295
295
296
296
// Same as above but unconditionally unavailable
@@ -303,22 +303,22 @@ extension ConformingType2 : Second {}
303
303
304
304
func usesConformingType2( _ c: ConformingType2 ) {
305
305
// We should pick First.doStuff() here, since Second.doStuff() is unavailable
306
- let result = c. doStuff ( 123 )
307
- let _: Bool = result
306
+ let result = c. doStuff ( 123 )
307
+ let _: Bool = result
308
308
}
309
309
310
310
// Make sure this also works for synthesized conformances
311
311
struct UnavailableHashable {
312
- let x : Int
313
- let y : Int
312
+ let x : Int
313
+ let y : Int
314
314
}
315
315
316
316
@available ( macOS 100 , * )
317
317
extension UnavailableHashable : Hashable { }
318
318
319
319
func usesUnavailableHashable( _ c: UnavailableHashable ) {
320
320
// expected-note@-1 2 {{add @available attribute to enclosing global function}}
321
- _ = Set ( [ c] )
322
- // expected-error@-1 2 {{conformance of 'UnavailableHashable' to 'Hashable' is only available in macOS 100 or newer}}
323
- // expected-note@-2 2 {{add 'if #available' version check}}
321
+ _ = Set ( [ c] )
322
+ // expected-error@-1 2 {{conformance of 'UnavailableHashable' to 'Hashable' is only available in macOS 100 or newer}}
323
+ // expected-note@-2 2 {{add 'if #available' version check}}
324
324
}
0 commit comments