Files
kotlin-fork/compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt
T
Dmitriy Novozhilov 6409bf2fe8 [FIR] Store expressions of receivers inside candidates instead of ReceiverValue
This is needed because of mutable nature of receiver values: implicit
  receiver values can be modified because of smartcasts, but in candidate
  we need to store snapshot of receiver in the form it was at the beginning
  of the resolution

^KT-58823 Fixed
2023-06-09 22:51:31 +00:00

23 lines
378 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// ISSUE: KT-58823
// FILE: Base.java
public abstract class Base {}
// FILE: Derived.java
public class Derived extends Base {
<T> T getResult() {
return (T) "OK";
}
}
// FILE: main.kt
fun Base.box(): String {
return when (this) {
is Derived -> getResult()
else -> "Fail"
}
}
fun box(): String = Derived().box()