Files
kotlin-fork/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.kt
T
2021-03-12 18:47:34 +03:00

14 lines
276 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// !LANGUAGE: +VariableDeclarationInWhenSubject
fun foo(): Any = 1
fun test() =
when (val y = foo()) {
42 -> 1
is String -> y.length
!is Int -> 2
in 0..10 -> 3
!in 10..20 -> 4
else -> -1
}