Skip to content

Commit 48cf822

Browse files
committed
[Test] Adds a diagnostic test as well
1 parent 1ce8cde commit 48cf822

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/Generics/conditional_conformances.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,3 +402,14 @@ extension BinaryInteger {
402402
// expected-error@-1 {{referencing instance method 'reduce' on 'ClosedRange' requires that 'Self.Stride' conform to 'SignedInteger'}}
403403
}
404404
}
405+
406+
// SR-10992
407+
408+
protocol SR_10992_P {}
409+
struct SR_10992_S<T> {}
410+
extension SR_10992_S: SR_10992_P where T: SR_10992_P {} // expected-note {{requirement from conditional conformance of 'SR_10992_S<String>' to 'SR_10992_P'}}
411+
412+
func sr_10992_foo(_ fn: (SR_10992_S<String>) -> Void) {}
413+
func sr_10992_bar(_ fn: (SR_10992_P) -> Void) {
414+
sr_10992_foo(fn) // expected-error {{global function 'sr_10992_foo' requires that 'String' conform to 'SR_10992_P'}}
415+
}

0 commit comments

Comments
 (0)