From d1efac617d0ab8c9dbce491c36f7bba93cfd5b63 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Fri, 21 Dec 2018 13:34:40 +0100 Subject: [PATCH] Get rid of reduntant jvm parts in tests --- .../codegen/box/controlStructures/kt8148.kt | 4 +--- .../box/controlStructures/kt8148_break.kt | 4 +--- .../box/controlStructures/kt8148_continue.kt | 4 +--- .../codegen/box/controlStructures/kt9022Throw.kt | 4 +--- .../testData/codegen/box/functions/kt1199.kt | 9 +++------ .../testData/codegen/box/properties/kt1398.kt | 4 ++-- .../box/ranges/contains/inRangeWithSmartCast.kt | 16 ++++++++-------- .../boxInline/tryCatchFinally/tryCatch.kt | 4 ++-- .../boxInline/tryCatchFinally/tryCatch2.kt | 4 ++-- .../boxInline/tryCatchFinally/tryCatchFinally.kt | 3 +-- 10 files changed, 22 insertions(+), 34 deletions(-) diff --git a/compiler/testData/codegen/box/controlStructures/kt8148.kt b/compiler/testData/codegen/box/controlStructures/kt8148.kt index a5de63158bf..e644af5aeb6 100644 --- a/compiler/testData/codegen/box/controlStructures/kt8148.kt +++ b/compiler/testData/codegen/box/controlStructures/kt8148.kt @@ -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) { } diff --git a/compiler/testData/codegen/box/controlStructures/kt8148_break.kt b/compiler/testData/codegen/box/controlStructures/kt8148_break.kt index d86cc0f65b4..348c38a7fde 100644 --- a/compiler/testData/codegen/box/controlStructures/kt8148_break.kt +++ b/compiler/testData/codegen/box/controlStructures/kt8148_break.kt @@ -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) { } diff --git a/compiler/testData/codegen/box/controlStructures/kt8148_continue.kt b/compiler/testData/codegen/box/controlStructures/kt8148_continue.kt index 78ae24ddb4e..dab64b8462b 100644 --- a/compiler/testData/codegen/box/controlStructures/kt8148_continue.kt +++ b/compiler/testData/codegen/box/controlStructures/kt8148_continue.kt @@ -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) { } diff --git a/compiler/testData/codegen/box/controlStructures/kt9022Throw.kt b/compiler/testData/codegen/box/controlStructures/kt9022Throw.kt index 992f7f4d14b..281f399cafe 100644 --- a/compiler/testData/codegen/box/controlStructures/kt9022Throw.kt +++ b/compiler/testData/codegen/box/controlStructures/kt9022Throw.kt @@ -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" } } diff --git a/compiler/testData/codegen/box/functions/kt1199.kt b/compiler/testData/codegen/box/functions/kt1199.kt index 36df6f19e5d..6fcfedac539 100644 --- a/compiler/testData/codegen/box/functions/kt1199.kt +++ b/compiler/testData/codegen/box/functions/kt1199.kt @@ -1,14 +1,11 @@ -// TARGET_BACKEND: JVM - - interface MyIterator { operator fun hasNext() : Boolean operator fun next() : T } operator fun T?.iterator() = object : MyIterator { - 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?.iterator() = object : MyIterator { hasNext = false return this@iterator!! } - throw java.util.NoSuchElementException() + throw NoSuchElementException() } } diff --git a/compiler/testData/codegen/box/properties/kt1398.kt b/compiler/testData/codegen/box/properties/kt1398.kt index 9e12ea12316..35d9900c8f2 100644 --- a/compiler/testData/codegen/box/properties/kt1398.kt +++ b/compiler/testData/codegen/box/properties/kt1398.kt @@ -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() diff --git a/compiler/testData/codegen/box/ranges/contains/inRangeWithSmartCast.kt b/compiler/testData/codegen/box/ranges/contains/inRangeWithSmartCast.kt index 60c5de8e815..29f7c3b30b2 100644 --- a/compiler/testData/codegen/box/ranges/contains/inRangeWithSmartCast.kt +++ b/compiler/testData/codegen/box/ranges/contains/inRangeWithSmartCast.kt @@ -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" } diff --git a/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatch.kt b/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatch.kt index a7e996a2576..29fc56b6f41 100644 --- a/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatch.kt +++ b/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatch.kt @@ -1,5 +1,5 @@ -// TARGET_BACKEND: JVM // FILE: 1.kt +// WITH_RUNTIME class My(val value: Int) @@ -7,7 +7,7 @@ inline fun T.perform(job: (T)-> R) : R { return job(this) } -public inline fun String.toInt2() : Int = java.lang.Integer.parseInt(this) +public inline fun String.toInt2() : Int = this.toInt() // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatch2.kt b/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatch2.kt index 126cfaa6238..41ea9b06475 100644 --- a/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatch2.kt +++ b/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatch2.kt @@ -1,5 +1,5 @@ -// TARGET_BACKEND: JVM // FILE: 1.kt +// WITH_RUNTIME class My(val value: Int) @@ -19,7 +19,7 @@ inline fun T.performWithFail2(job: (T)-> R, failJob : (e: RuntimeExceptio } } -public inline fun String.toInt2() : Int = java.lang.Integer.parseInt(this) +public inline fun String.toInt2() : Int = this.toInt() // FILE: 2.kt diff --git a/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatchFinally.kt b/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatchFinally.kt index b086381c3d8..6fae9a4a82d 100644 --- a/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatchFinally.kt +++ b/compiler/testData/codegen/boxInline/tryCatchFinally/tryCatchFinally.kt @@ -1,4 +1,3 @@ -// TARGET_BACKEND: JVM // FILE: 1.kt // WITH_RUNTIME @@ -22,7 +21,7 @@ inline fun T.performWithFailFinally(job: (T)-> R, failJob : (e: RuntimeEx } } -inline fun String.toInt2() : Int = java.lang.Integer.parseInt(this) +inline fun String.toInt2() : Int = this.toInt() // FILE: 2.kt