Kotlin: fix pattern for when without subject

This commit is contained in:
HiPhish 2023-11-19 16:40:12 +01:00
parent 8ee0af5e32
commit c6dce365e6
2 changed files with 8 additions and 2 deletions

View file

@ -36,9 +36,9 @@
")" @delimiter @sentinel) @container
(when_expression
subject: (when_subject
(when_subject
"(" @delimiter
")" @delimiter)
")" @delimiter)?
"{" @delimiter
"}" @delimiter @sentinel) @container

View file

@ -85,6 +85,12 @@ when (x) {
else -> println("x is neither 1 nor 2")
}
when {
1 == 1 -> print("1")
else -> print("not")
}
val rows = 2
val cols = 3
val matrix = Array(rows) { IntArray(cols) }