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
20 lines
517 B
Kotlin
20 lines
517 B
Kotlin
package foo
|
|
|
|
fun box(): String {
|
|
var res = try { 10 } catch(e: Exception) { 20 }
|
|
assertEquals(10, res)
|
|
|
|
res = try { 10 } catch(e: Exception) { 20 } finally { 80 }
|
|
assertEquals(10, res)
|
|
|
|
res = try { 10; throw RuntimeException() } catch(e: Exception) { 20 }
|
|
assertEquals(20, res)
|
|
|
|
res = try { 10; throw RuntimeException() } catch(e: Exception) { 20 } finally { 100 }
|
|
assertEquals(20, res)
|
|
|
|
res = 50 + try { 10 } catch(e: Exception) { 20 }
|
|
assertEquals(60, res)
|
|
|
|
return "OK"
|
|
} |