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:
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user