KT-36047 Support when-with-subject in optimized 'when' generators

This commit is contained in:
Dmitry Petrov
2020-03-11 14:50:06 +03:00
parent fd70b10b17
commit a9ab3ae192
8 changed files with 79 additions and 8 deletions
@@ -0,0 +1,12 @@
fun foo(x: String): String {
return when (val y = x) {
"1" -> "one"
"2" -> "two"
"3" -> "two and one"
"4" -> "two and two"
else -> "many"
}
}
// 0 LOOKUPSWITCH
// 1 TABLESWITCH