K2: don't accept reflective function kinds as possible lambda type

#KT-56954 Fixed
This commit is contained in:
Mikhail Glukhikh
2023-03-08 17:35:19 +01:00
committed by Space Team
parent 7a6ff5de34
commit af78ef77b4
3 changed files with 3 additions and 3 deletions
@@ -2,7 +2,7 @@ FILE: lambdaForKfunction.kt
public final fun foo(arg: R|kotlin/reflect/KFunction0<kotlin/Unit>|): R|kotlin/Unit| {
}
public final fun main(): R|kotlin/Unit| {
R|/foo|(fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
R|/foo<Inapplicable(INAPPLICABLE): /foo>#|(fun <anonymous>(): R|kotlin/Unit| <inline=Unknown> {
}
)
}
@@ -5,5 +5,5 @@ import kotlin.reflect.KFunction0
fun foo(arg: KFunction0<Unit>) {}
fun main() {
foo(fun() {}) // K1: TYPE_MISMATCH, K2: ok in compile-time & CCE at run-time
foo(<!ARGUMENT_TYPE_MISMATCH!>fun() {}<!>) // K1: TYPE_MISMATCH, K2: ok in compile-time & CCE at run-time
}