forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiag_ambiguities.swift
30 lines (20 loc) · 1.05 KB
/
diag_ambiguities.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// RUN: %target-parse-verify-swift
func f0(i: Int, _ d: Double) {} // expected-note{{found this candidate}}
func f0(d: Double, _ i: Int) {} // expected-note{{found this candidate}}
f0(1, 2) // expected-error{{ambiguous use of 'f0'}}
func f1(i: Int16) {} // expected-note{{found this candidate}}
func f1(i: Int32) {} // expected-note{{found this candidate}}
f1(0) // expected-error{{ambiguous use of 'f1'}}
infix operator +++ { }
func +++(i: Int, d: Double) {} // expected-note{{found this candidate}}
func +++(d: Double, i: Int) {} // expected-note{{found this candidate}}
1 +++ 2 // expected-error{{ambiguous use of operator '+++'}}
class C {
init(_ action: (Int) -> ()) {} // expected-note{{found this candidate}}
init(_ action: (Int, Int) -> ()) {} // expected-note{{found this candidate}}
}
func g(x: Int) -> () {} // expected-note{{found this candidate}}
func g(x: Int, _ y: Int) -> () {} // expected-note{{found this candidate}}
C(g) // expected-error{{ambiguous use of 'g'}}
func h<T>(x: T) -> () {}
C(h) // expected-error{{ambiguous use of 'init'}}