Psi2ir: fix function type check for fun interface conversion

Parameter of a synthetic SAM adapter always has a function type (not a
subtype). Checking for the subtypes broke the case from KT-46908, where
fun interface is itself a subtype of a function type.

 #KT-46908 Fixed
This commit is contained in:
Alexander Udalov
2021-09-29 16:17:01 +02:00
parent e6a160e115
commit 9857af7823
18 changed files with 173 additions and 2 deletions
@@ -0,0 +1,18 @@
// IGNORE_BACKEND: JS, JS_IR, WASM
fun interface Foo : () -> Int
fun id(foo: Foo): Any = foo
fun box(): String {
val p1 = object : Foo {
override fun invoke(): Int = 42
override fun toString(): String = "OK"
}
val p2 = id(p1)
if (p1 !== p2) return "Fail identity equals"
if (p1.toString() != p2.toString()) return "Fail toString"
return p2.toString()
}