Skip to content

Commit 46476e5

Browse files
committed
[TypeChecker] Extend test-case for rdar://problem/39401774
Add generic and non-generic method resolution ambiguities.
1 parent d3ab36f commit 46476e5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/Constraints/rdar39401774.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
// RUN: %target-typecheck-verify-swift
22

3-
class A {
4-
var foo: Int? { return 42 } // expected-note {{found this candidate}}
3+
class A<T> {
4+
var foo: Int? { return 42 } // expected-note {{found this candidate}}
5+
func baz() -> T { fatalError() } // expected-note {{found this candidate}}
6+
func fiz() -> Int { return 42 } // expected-note {{found this candidate}}
57
}
68

79
protocol P1 {
10+
associatedtype T
811
var foo: Int? { get } // expected-note {{found this candidate}}
12+
func baz() -> T // expected-note {{found this candidate}}
13+
func fiz() -> Int // expected-note {{found this candidate}}
914
}
1015

1116
protocol P2 : P1 {
1217
var bar: Int? { get }
1318
}
1419

15-
extension P2 where Self: A {
20+
extension P2 where Self: A<Int> {
1621
var bar: Int? {
1722
guard let foo = foo else { return 0 } // expected-error {{ambiguous use of 'foo'}}
18-
return foo
23+
let _ = baz() // expected-error {{ambiguous use of 'baz()'}}
24+
return fiz() // expected-error {{ambiguous use of 'fiz()'}}
1925
}
2026
}

0 commit comments

Comments
 (0)