mirror of
https://github.com/github/codeql.git
synced 2025-12-19 10:23:15 +01:00
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.
11 lines
155 B
Kotlin
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
|
|
}
|
|
}
|
|
|