Files
kotlin-fork/idea/testData/codegen/extensionFunctions/whenFail.jet
T

15 lines
306 B
Plaintext

fun StringBuilder.takeFirst(): Char {
if (this.length() == 0) return '\0'
val c = this.charAt(0)
this.deleteCharAt(0)
return c
}
fun foo(expr: StringBuilder): Int {
val c = expr.takeFirst()
when(c) {
'\0' => throw new Exception("zero")
else => throw new Exception("nonzero" + c)
}
}