FIR: Refine callable reference resolution in assignment position
synthetic_select<() -> T>(::foo) form allows to select better candidate than synthetic_select(::foo) with expect type `() -> T`
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
// FIR_IDENTICAL
|
||||
// SKIP_TXT
|
||||
|
||||
// FILE: lib.kt
|
||||
package lib
|
||||
fun foo(x: Double): Double = x
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
import lib.*
|
||||
|
||||
fun foo(): Map<Int, String> = TODO()
|
||||
|
||||
var z: (x: Double) -> Double = { it }
|
||||
|
||||
fun bar() {
|
||||
z = ::foo
|
||||
}
|
||||
|
||||
fun baz(x: (Double) -> Double) {}
|
||||
+2
-2
@@ -22,6 +22,6 @@ class A3<T> {
|
||||
fun test2(): (T) -> Unit = A3<T>()::a3
|
||||
fun test3(): (Int) -> String = A3<Int>()::a3
|
||||
|
||||
fun <R> test4(): (R) -> Unit = <!RETURN_TYPE_MISMATCH!>this::a3<!>
|
||||
fun <R> test4(): (R) -> Unit = this::<!UNRESOLVED_REFERENCE!>a3<!>
|
||||
fun <R> test5(): (T) -> R = this::a3
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -6,5 +6,5 @@ fun foo(i: Int) {}
|
||||
|
||||
val fn1: (Int) -> Unit = ::foo
|
||||
val fn2: (IntArray) -> Unit = ::foo
|
||||
val fn3: (Int, Int) -> Unit = ::foo
|
||||
val fn4: (Array<String>) -> Unit = ::foo
|
||||
val fn3: (Int, Int) -> Unit = ::<!UNRESOLVED_REFERENCE!>foo<!>
|
||||
val fn4: (Array<String>) -> Unit = ::foo
|
||||
|
||||
Reference in New Issue
Block a user