[FIR] Fix incorrect resolve of callable reference in function signature (^KT-48304 Fixed)
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
|
||||
fun a() {
|
||||
val x = 10
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(::<!UNSUPPORTED!>x<!>)
|
||||
}
|
||||
|
||||
fun foo(a: Any) {}
|
||||
|
||||
fun test1(test2: () -> Unit = ::test2) {} // Resolve to function
|
||||
private fun test2() {}
|
||||
fun test3(test4: () -> Unit = ::<!UNSUPPORTED!>test4<!>) {}
|
||||
|
||||
fun test5(test6: (test: Test) -> Unit = Test::helper) {
|
||||
test6(Test())
|
||||
}
|
||||
|
||||
class Test {
|
||||
fun helper() {}
|
||||
}
|
||||
|
||||
+14
-1
@@ -1,9 +1,22 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
|
||||
fun a() {
|
||||
val x = 10
|
||||
foo(::<!UNSUPPORTED!>x<!>)
|
||||
}
|
||||
|
||||
fun foo(a: Any) {}
|
||||
|
||||
fun test1(test2: () -> Unit = ::test2) {} // Resolve to function
|
||||
private fun test2() {}
|
||||
fun test3(test4: () -> Unit = ::<!UNSUPPORTED!>test4<!>) {}
|
||||
|
||||
fun test5(test6: (test: Test) -> Unit = Test::helper) {
|
||||
test6(Test())
|
||||
}
|
||||
|
||||
class Test {
|
||||
fun helper() {}
|
||||
}
|
||||
|
||||
|
||||
+13
@@ -2,3 +2,16 @@ package
|
||||
|
||||
public fun a(): kotlin.Unit
|
||||
public fun foo(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
public fun test1(/*0*/ test2: () -> kotlin.Unit = ...): kotlin.Unit
|
||||
private fun test2(): kotlin.Unit
|
||||
public fun test3(/*0*/ test4: () -> kotlin.Unit = ...): kotlin.Unit
|
||||
public fun test5(/*0*/ test6: (test: Test) -> kotlin.Unit = ...): kotlin.Unit
|
||||
|
||||
public final class Test {
|
||||
public constructor Test()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun helper(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
fun eat(value: Any) {}
|
||||
|
||||
fun test(param: String) {
|
||||
val a = ::<!UNSUPPORTED!>param<!>
|
||||
|
||||
val local = "local"
|
||||
val b = ::<!UNSUPPORTED!>local<!>
|
||||
|
||||
val lambda = { -> }
|
||||
val g = ::<!UNSUPPORTED!>lambda<!>
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>eat<!>(::<!UNSUPPORTED!>param<!>)
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
fun eat(value: Any) {}
|
||||
|
||||
+1
-1
@@ -9,6 +9,6 @@ class Foo {
|
||||
fun main() {
|
||||
val f = Foo()
|
||||
val a: Int
|
||||
<!VARIABLE_EXPECTED!>get()<!> = f.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getValue<!>(null, ::<!UNSUPPORTED!>a<!>) // no exception after fix
|
||||
<!VARIABLE_EXPECTED!>get()<!> = f.<!INAPPLICABLE_CANDIDATE!>getValue<!>(null, ::<!UNSUPPORTED!>a<!>) // no exception after fix
|
||||
<!UNRESOLVED_REFERENCE!>print<!>(<!UNINITIALIZED_VARIABLE!>a<!>)
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -9,6 +9,6 @@ class Foo {
|
||||
fun main(x: Int) {
|
||||
val f = Foo()
|
||||
val a: Int
|
||||
<!VARIABLE_EXPECTED!>get()<!> = f.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>getValue<!>(null, ::<!UNSUPPORTED!>x<!>) // no exception after fix
|
||||
<!VARIABLE_EXPECTED!>get()<!> = f.<!INAPPLICABLE_CANDIDATE!>getValue<!>(null, ::<!UNSUPPORTED!>x<!>) // no exception after fix
|
||||
<!UNRESOLVED_REFERENCE!>print<!>(<!UNINITIALIZED_VARIABLE!>a<!>)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user