53f0e6dcd2
#KT-5576 Fixed #KT-5594 Fixed #KT-3166 Fixed #KT-5545 Fixed #KT-5594 Fixed #KT-5258 Fixed JS backend: fix KT-4879: extra side effect when use when in default arguments #KT-4879 Fixed JS backend: improve and fix WhenTranslator, fix order of evaluation for condtitions, fix KT-5263 (JS: extra tmp when initialize val in when by expression with if) #KT-5263 Fixed
43 lines
860 B
Kotlin
Vendored
43 lines
860 B
Kotlin
Vendored
// http://youtrack.jetbrains.com/issue/KT-5594
|
|
// JS: compiler crashes
|
|
|
|
package foo
|
|
|
|
fun bar(f: () -> Unit) {
|
|
}
|
|
|
|
fun test() {
|
|
bar {
|
|
// val actionId: Any = 1
|
|
val item: Any? = 1
|
|
if (item != null) {
|
|
// In original version, as I remember, `when` was an important to reproduce, but now it is not.
|
|
// when(actionId){
|
|
// 1 -> { 1 }
|
|
// "2" -> { "2"}
|
|
// else -> {}
|
|
// }
|
|
}
|
|
}
|
|
bar {
|
|
val actionId: Any = 1
|
|
val item: Any? = 1
|
|
if (item != null) {
|
|
when (actionId) {
|
|
1 -> {
|
|
1
|
|
}
|
|
"2" -> {
|
|
"2"
|
|
}
|
|
else -> {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
fun box(): String {
|
|
return "OK"
|
|
} |