Files
kotlin-fork/compiler/testData/diagnostics/tests/when/kt48653_after.kt
T
2021-09-12 16:04:18 +03:00

23 lines
473 B
Kotlin
Vendored

// FIR_IDENTICAL
// LANGUAGE: +ProhibitNonExhaustiveWhenOnAlgebraicTypes
// ISSUE: KT-48653
sealed class Sealed {
object A : Sealed()
object B : Sealed()
}
fun functionReturningSealed(): Sealed = null!!
fun test_1() {
<!NO_ELSE_IN_WHEN!>when<!> (val result = functionReturningSealed()) {
is Sealed.A -> {}
}
}
fun test_2() {
val result2 = functionReturningSealed()
<!NO_ELSE_IN_WHEN!>when<!> (result2) {
is Sealed.A -> {}
}
}