Files
codeql/java/ql/test/kotlin/library-tests/exprs/whenExpr.kt
Chris Smowton 5fe65ed983 Extract no-when-branch-found calls
These are extracted as "throw new kotlin.NoWhenBranchFoundException();", which is the Java lowering of the intrinsic.

In the process, amend the control-flow graph to let when branches propagate `throw`s outwards, and similarly statement expressions.
2022-05-10 19:51:19 +01:00

11 lines
155 B
Kotlin

fun testWhen(i: Int): Int {
return when(i) {
0 -> 1
1 -> 2
2 -> return 3
3 -> throw Exception("No threes please")
else -> 999
}
}