Skip to content

Commit 77a642a

Browse files
authored
Merge pull request #25489 from xedin/rdar-50512161
[TypeChecker] NFC: Add a test-case for rdar://problem/50512161
2 parents 1710d08 + 5b22e4b commit 77a642a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/Constraints/protocols.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,3 +401,20 @@ func rdar_50099849() {
401401
let _ = C<A, B>() // expected-error {{generic parameter 'C' could not be inferred}}
402402
// expected-note@-1 {{explicitly specify the generic arguments to fix this issue}} {{17-17=<<#C: Trivial#>>}}
403403
}
404+
405+
// rdar://problem/50512161 - improve diagnostic when generic parameter cannot be deduced
406+
func rdar_50512161() {
407+
struct Item {}
408+
409+
struct TrivialItem : Trivial {
410+
typealias T = Item?
411+
}
412+
413+
func foo<I>(_: I.Type = I.self, item: I.T) where I : Trivial { // expected-note {{in call to function 'foo(_:item:)'}}
414+
fatalError()
415+
}
416+
417+
func bar(_ item: Item) {
418+
foo(item: item) // expected-error {{generic parameter 'I' could not be inferred}}
419+
}
420+
}

0 commit comments

Comments
 (0)