KT-36953 break/continue/return/throw have kotlinType Nothing

This commit is contained in:
Dmitry Petrov
2020-03-10 11:08:17 +03:00
parent 603685b5a4
commit e175ff0d73
10 changed files with 122 additions and 4 deletions
@@ -0,0 +1,31 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
fun testBreak() {
for (i in 0..1) {
for (j in break downTo 1u) {}
}
}
fun testReturn() {
for (i in 0..1) {
for (j in (return) downTo 1u) {}
}
}
fun testThrow() {
try {
for (i in 0..1) {
for (j in (throw Exception()) downTo 1u) {
}
}
} catch (e: Exception) {}
}
fun box(): String {
testBreak()
testReturn()
testThrow()
return "OK"
}
@@ -0,0 +1,16 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
// IGNORE_BACKEND: JVM_IR
// ^ TODO KT-37373
fun testContinue() {
for (i in 0..1) {
for (j in continue downTo 1u) {}
}
}
fun box(): String {
testContinue()
return "OK"
}