[FIR] Report NONE_APPLICABLE on callable references with multiple failed candidates

This commit is contained in:
Kirill Rakhman
2023-11-07 15:33:31 +01:00
committed by Space Team
parent 6d2ab92d91
commit d54068b8ab
12 changed files with 33 additions and 31 deletions
@@ -10,7 +10,7 @@ fun test() {
val x2: (Int) -> Unit = baz(id(::foo), ::foo)
val x3: (Int) -> Unit = baz(id(::foo), id(id(::foo)))
val x4: (String) -> Unit = baz(id(::foo), id(id(::foo)))
val x5: (Double) -> Unit = baz(id(::<!UNRESOLVED_REFERENCE!>foo<!>), id(id(::<!UNRESOLVED_REFERENCE!>foo<!>)))
val x5: (Double) -> Unit = baz(id(::<!NONE_APPLICABLE!>foo<!>), id(id(::<!NONE_APPLICABLE!>foo<!>)))
id<(Int) -> Unit>(id(id(::foo)))
@@ -16,7 +16,7 @@ fun test1() {
baz<String>(::foo).checkType { _<String?>() }
baz<Boolean>(::foo).checkType { _<Boolean?>() }
val b1: Int = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>baz(::<!UNRESOLVED_REFERENCE!>foo<!>)<!>
val b2: String = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>baz(::<!UNRESOLVED_REFERENCE!>foo<!>)<!>
val b3: Boolean = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>baz(::<!UNRESOLVED_REFERENCE!>foo<!>)<!>
val b1: Int = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>baz(::<!NONE_APPLICABLE!>foo<!>)<!>
val b2: String = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>baz(::<!NONE_APPLICABLE!>foo<!>)<!>
val b3: Boolean = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>baz(::<!NONE_APPLICABLE!>foo<!>)<!>
}
@@ -4,9 +4,9 @@ fun test() {
val a1: Array<Double.(Double) -> Double> = arrayOf(Double::plus, Double::minus)
val a2: Array<Double.(Int) -> Double> = arrayOf(Double::plus, Double::minus)
val a3: Array<Int.(Int) -> Double> = arrayOf(Double::<!UNRESOLVED_REFERENCE!>plus<!>, Double::<!UNRESOLVED_REFERENCE!>minus<!>)
val a4: Array<Int.(Double) -> Double> = arrayOf(Int::plus, Double::<!UNRESOLVED_REFERENCE!>minus<!>)
val a5: Array<Double.(Double) -> Double> = arrayOf(Double::plus, Int::<!UNRESOLVED_REFERENCE!>minus<!>)
val a3: Array<Int.(Int) -> Double> = arrayOf(Double::<!NONE_APPLICABLE!>plus<!>, Double::<!NONE_APPLICABLE!>minus<!>)
val a4: Array<Int.(Double) -> Double> = arrayOf(Int::plus, Double::<!NONE_APPLICABLE!>minus<!>)
val a5: Array<Double.(Double) -> Double> = arrayOf(Double::plus, Int::<!NONE_APPLICABLE!>minus<!>)
}
fun foo(x: Int) {}
@@ -17,5 +17,5 @@ fun <T> bar(x: T, f: (T) -> Unit) {}
fun test2() {
bar(1, ::foo)
bar("", ::foo)
bar(1.0, ::<!UNRESOLVED_REFERENCE!>foo<!>)
bar(1.0, ::<!NONE_APPLICABLE!>foo<!>)
}
@@ -7,4 +7,4 @@ fun foo(s: String) {}
val x1 = ofType<() -> Unit>(::foo)
val x2 = ofType<(String) -> Unit>(::foo)
val x3 = ofType<(Int) -> Unit>(::<!UNRESOLVED_REFERENCE!>foo<!>)
val x3 = ofType<(Int) -> Unit>(::<!NONE_APPLICABLE!>foo<!>)
@@ -8,4 +8,4 @@ fun foo(s: String) {}
val x1 = apply(1, ::foo)
val x2 = apply("hello", ::foo)
val x3 = apply(true, ::<!UNRESOLVED_REFERENCE!>foo<!>)
val x3 = apply(true, ::<!NONE_APPLICABLE!>foo<!>)