report 'ambiguity' on reference, not on the whole expression
as other type inference errors
This commit is contained in:
+1
-1
@@ -143,7 +143,7 @@ public class TracingStrategyImpl implements TracingStrategy {
|
||||
|
||||
@Override
|
||||
public <D extends CallableDescriptor> void ambiguity(@NotNull BindingTrace trace, @NotNull Collection<ResolvedCallWithTrace<D>> descriptors) {
|
||||
trace.report(OVERLOAD_RESOLUTION_AMBIGUITY.on(call.getCallElement(), descriptors));
|
||||
trace.report(OVERLOAD_RESOLUTION_AMBIGUITY.on(reference, descriptors));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,7 +10,7 @@ class C() {
|
||||
fun test(a : Any?) {
|
||||
if (a is B) {
|
||||
if (a is C) {
|
||||
a.<!OVERLOAD_RESOLUTION_AMBIGUITY!>bar()<!>;
|
||||
a.<!OVERLOAD_RESOLUTION_AMBIGUITY!>bar<!>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ fun foo() {
|
||||
bar(<!TYPE_MISMATCH!>x<!>)
|
||||
if (x != 2) {
|
||||
if (x == null) return
|
||||
2+<!SYNTAX!><!>
|
||||
2<!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!><!SYNTAX!><!>
|
||||
}
|
||||
else {
|
||||
if (<!SENSELESS_COMPARISON!>x == null<!>) return
|
||||
2+<!SYNTAX!><!>
|
||||
2<!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!><!SYNTAX!><!>
|
||||
}
|
||||
bar(x)
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class A {
|
||||
// FILE: test.kt
|
||||
|
||||
fun main() {
|
||||
A.<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo { "Hello!" }<!>
|
||||
A.<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!> { "Hello!" }
|
||||
A.foo(Runnable { "Hello!" })
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class MyIterator {
|
||||
class MyElement
|
||||
|
||||
fun test1(collection: MyCollection) {
|
||||
collection.<!OVERLOAD_RESOLUTION_AMBIGUITY!>iterator()<!>
|
||||
collection.<!OVERLOAD_RESOLUTION_AMBIGUITY!>iterator<!>()
|
||||
for (element in <!ITERATOR_AMBIGUITY!>collection<!>) {
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// FILE: checkAmbiguityBetweenRootAndPackage.kt
|
||||
package test
|
||||
|
||||
val t = <!OVERLOAD_RESOLUTION_AMBIGUITY!>testFun()<!>
|
||||
val t = <!OVERLOAD_RESOLUTION_AMBIGUITY!>testFun<!>()
|
||||
|
||||
// FILE: checkAmbiguityBetweenRootAndPackageRoot.kt
|
||||
fun testFun() = 12
|
||||
|
||||
@@ -12,7 +12,7 @@ class C() {
|
||||
fun test(a : Any?) {
|
||||
if (a is B) {
|
||||
if (a is C) {
|
||||
a.<!OVERLOAD_RESOLUTION_AMBIGUITY!>bar()<!>;
|
||||
a.<!OVERLOAD_RESOLUTION_AMBIGUITY!>bar<!>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ fun foo(vararg <!UNUSED_PARAMETER!>t<!> : String) = ""
|
||||
fun foo(vararg <!UNUSED_PARAMETER!>t<!> : Int) = ""
|
||||
|
||||
fun test() {
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo()<!>
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>()
|
||||
}
|
||||
@@ -3,9 +3,9 @@ fun main(j : C, s : Array<String?>) {
|
||||
j.from()
|
||||
j.from("")
|
||||
j.from("", "")
|
||||
j.<!OVERLOAD_RESOLUTION_AMBIGUITY!>from("", "", "")<!>
|
||||
j.<!OVERLOAD_RESOLUTION_AMBIGUITY!>from<!>("", "", "")
|
||||
|
||||
j.<!OVERLOAD_RESOLUTION_AMBIGUITY!>from("", *s)<!> // This should not be an ambiguity, see KT-1842
|
||||
j.<!OVERLOAD_RESOLUTION_AMBIGUITY!>from<!>("", *s) // This should not be an ambiguity, see KT-1842
|
||||
j.from(*s)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user