mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Introduces very basic support for diagnosing ambiguous expressions,
where the source of the ambiguity is a reference to an overloaded
name. Simple example:
t.swift:4:1: error: ambiguous use of 'f0'
f0(1, 2)
^
t.swift:1:6: note: found this candidate
func f0(i : Int, d : Double) {}
^
t.swift:2:6: note: found this candidate
func f0(d : Double, i : Int) {}
^
There's a lot of work needed to make this cleaner, but perhaps it will
ease the pain of developing the library <rdar://problem/14277889>.
Swift SVN r6195
20 lines
647 B
Swift
20 lines
647 B
Swift
// RUN: %swift -parse %s -verify
|
|
|
|
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'}}
|
|
|
|
operator infix +++ { }
|
|
|
|
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 '+++'}}
|
|
|