Files
kotlin-fork/compiler/testData/codegen/box/jvm8/kt29242.kt
T
Mikhael Bogdanov 320c5f6f00 Cast dispatch receiver to actual declaration owner though inline
Otherwise corrupted frame information is generated in bytecode

 #KT-29242 Fixed
2019-11-29 13:15:42 +01:00

25 lines
614 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// See also kt33054.kt
fun causesVerifyErrorSample(): Sample<Boolean> = Sample
.Success(true)
.flatMap { Sample.Failure(RuntimeException()) }
sealed class Sample<out T> {
inline fun <R> flatMap(f: (T) -> Sample<R>): Sample<R> =
when (this) {
is Failure -> this
is Success -> f(this.value)
}
data class Failure(val exception: Throwable): Sample<Nothing>()
data class Success<out T>(val value: T): Sample<T>()
}
fun box(): String {
causesVerifyErrorSample()
return "OK"
}