Get rid of reduntant jvm parts in tests
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
class A(var value: String)
|
||||
|
||||
fun box(): String {
|
||||
@@ -7,7 +5,7 @@ fun box(): String {
|
||||
|
||||
try {
|
||||
test(a)
|
||||
} catch(e: java.lang.RuntimeException) {
|
||||
} catch(e: RuntimeException) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
class A(var value: String)
|
||||
|
||||
fun box(): String {
|
||||
@@ -7,7 +5,7 @@ fun box(): String {
|
||||
|
||||
try {
|
||||
test(a)
|
||||
} catch(e: java.lang.RuntimeException) {
|
||||
} catch(e: RuntimeException) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
class A(var value: String)
|
||||
|
||||
fun box(): String {
|
||||
@@ -7,7 +5,7 @@ fun box(): String {
|
||||
|
||||
try {
|
||||
test(a)
|
||||
} catch(e: java.lang.RuntimeException) {
|
||||
} catch(e: RuntimeException) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
fun box(): String {
|
||||
var cycle = true;
|
||||
while (true) {
|
||||
if (true || throw java.lang.RuntimeException()) {
|
||||
if (true || throw RuntimeException()) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
+3
-6
@@ -1,14 +1,11 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
|
||||
interface MyIterator<T> {
|
||||
operator fun hasNext() : Boolean
|
||||
operator fun next() : T
|
||||
}
|
||||
|
||||
operator fun <T : Any> T?.iterator() = object : MyIterator<T> {
|
||||
var hasNext = this@iterator != null
|
||||
private set
|
||||
private var hasNext = this@iterator != null
|
||||
|
||||
override fun hasNext() = hasNext
|
||||
|
||||
override fun next() : T {
|
||||
@@ -16,7 +13,7 @@ operator fun <T : Any> T?.iterator() = object : MyIterator<T> {
|
||||
hasNext = false
|
||||
return this@iterator!!
|
||||
}
|
||||
throw java.util.NoSuchElementException()
|
||||
throw NoSuchElementException()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
open class Base(val bar: String)
|
||||
|
||||
class Foo(bar: String) : Base(bar) {
|
||||
fun something() = (bar as java.lang.String).toUpperCase()
|
||||
fun something() = bar.toUpperCase()
|
||||
}
|
||||
|
||||
fun box() = Foo("ok").something()
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// IGNORE_BACKEND: JS_IR, NATIVE
|
||||
// WITH_RUNTIME
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
fun check(x: Any?): Boolean {
|
||||
if (x is Int) {
|
||||
return x in 239..240
|
||||
}
|
||||
|
||||
throw java.lang.AssertionError()
|
||||
throw AssertionError()
|
||||
}
|
||||
|
||||
fun check(x: Any?, l: Any?, r: Any?): Boolean {
|
||||
@@ -15,14 +15,14 @@ fun check(x: Any?, l: Any?, r: Any?): Boolean {
|
||||
return x in l..r
|
||||
}
|
||||
|
||||
throw java.lang.AssertionError()
|
||||
throw AssertionError()
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
assert(check(239))
|
||||
assert(check(239, 239, 240))
|
||||
assert(!check(238))
|
||||
assert(!check(238, 239, 240))
|
||||
assertTrue(check(239))
|
||||
assertTrue(check(239, 239, 240))
|
||||
assertTrue(!check(238))
|
||||
assertTrue(!check(238, 239, 240))
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user