Skip to content

Commit c3ba584

Browse files
committed
Fix tests
1 parent 2319b8d commit c3ba584

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/Constraints/opened_existentials.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,15 +311,15 @@ class C1 {}
311311
class C2<T>: C1 {}
312312

313313
// Protocols With Associated Types
314-
protocol Q {
314+
protocol T {
315315
associatedtype A
316316
associatedtype B: C2<A>
317317

318318
func returnAssocTypeB() -> B
319319
}
320320

321-
func testAssocReturn(p: any Q) {
322-
let _ = p.returnAssocTypeB() // expected-error {{inferred result type 'C2<(any U<String>).A>' requires explicit coercion due to loss of generic requirements}} {{14-14=as as C2<(any Q).A>}}
321+
func testAssocReturn(p: any T) {
322+
let _ = p.returnAssocTypeB() // expected-error {{inferred result type 'C2<(any T).A>' requires explicit coercion due to loss of generic requirements}} {{29-29=as C2<(any T).A>}}
323323
}
324324

325325
// Protocols With Primary Associated Types
@@ -333,13 +333,14 @@ protocol U<A> {
333333
}
334334

335335
func testPrimaryAssocReturn(p: any U<String>) {
336-
let _ = p.returnAssocTypeB()
336+
let _ = p.returnAssocTypeB() // expected-error {{inferred result type 'C2<(any U<String>).A>' requires explicit coercion due to loss of generic requirements}} {{29-29=as C2<(any U<String>).A>}}
337337
}
338338

339339
func testPrimaryAssocReturn(p: any U<Int>) {
340-
let _ = p.returnPrimaryAssocTypeA() // what would the output even be here?
340+
let _ = p.returnPrimaryAssocTypeA()
341341
}
342342

343+
@available
343344
func testPrimaryAssocCollection(p: any U<Float>) -> any Collection {
344345
let x = p.returnAssocTypeCollection()
345346
return x

0 commit comments

Comments
 (0)