KT-12254 Prevent JsEmptyExpression from getting into initializer JS when compiling code like val x = throw Exception()

This commit is contained in:
Alexey Andreev
2016-05-10 19:06:15 +03:00
parent 4387c31939
commit cb36b61f7f
4 changed files with 26 additions and 3 deletions
@@ -0,0 +1,15 @@
// See KT-12254
package foo
object A {
var x: Int = throw RuntimeException("catch me")
}
fun box(): String {
try {
return "fail: ${A.x.toString()}"
}
catch (e: RuntimeException) {
return if (e.message == "catch me") "OK" else "fail: ${e.message}"
}
}