Files
kotlin-fork/compiler/testData/codegen/box/smartCasts/toStringOnReceiverWIthSmartcast.kt
T
Dmitriy Novozhilov 6e2402620f [FIR] Fix collecting member candidates on receiver with smartcast
^KT-51460 Fixed
^KT-51827
2022-04-07 12:18:48 +00:00

30 lines
451 B
Kotlin
Vendored

// TARGET_BACKEND: JVM_IR
// FILE: A.java
public class A {
@Override
public String toString() {
return "O";
}
}
// FILE: B.java
public class B {
@Override
public String toString() {
return "K";
}
}
// FILE: main.kt
fun test(x: Any): String {
return when (x) {
is A -> x.toString()
is B -> x.toString()
else -> "fail"
}
}
fun box(): String {
return test(A()) + test(B())
}