From ac5f5bd4538ff8fd60a279971438dc7c0624d91c Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Fri, 21 Dec 2018 16:59:13 +0100 Subject: [PATCH] Get rid of jvm specific code in some tests --- .../codegen/box/casts/functions/asFunKSmall.kt | 6 ++++-- .../box/casts/functions/reifiedAsFunKSmall.kt | 6 ++++-- .../casts/mutableCollections/weirdMutableCasts.kt | 8 +++++--- .../semantics/IrJsCodegenBoxTestGenerated.java | 15 +++++++++++++++ .../test/semantics/JsCodegenBoxTestGenerated.java | 15 +++++++++++++++ 5 files changed, 43 insertions(+), 7 deletions(-) diff --git a/compiler/testData/codegen/box/casts/functions/asFunKSmall.kt b/compiler/testData/codegen/box/casts/functions/asFunKSmall.kt index 63c491a252b..ba59dbf1e1d 100644 --- a/compiler/testData/codegen/box/casts/functions/asFunKSmall.kt +++ b/compiler/testData/codegen/box/casts/functions/asFunKSmall.kt @@ -1,4 +1,6 @@ -// TARGET_BACKEND: JVM +// IGNORE_BACKEND: JS_IR +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS, NATIVE fun fn0() {} fun fn1(x: Any) {} @@ -7,7 +9,7 @@ inline fun asFailsWithCCE(operation: String, block: () -> Unit) { try { block() } - catch (e: java.lang.ClassCastException) { + catch (e: ClassCastException) { return } catch (e: Throwable) { diff --git a/compiler/testData/codegen/box/casts/functions/reifiedAsFunKSmall.kt b/compiler/testData/codegen/box/casts/functions/reifiedAsFunKSmall.kt index 15852ce35b5..18c83640c36 100644 --- a/compiler/testData/codegen/box/casts/functions/reifiedAsFunKSmall.kt +++ b/compiler/testData/codegen/box/casts/functions/reifiedAsFunKSmall.kt @@ -1,5 +1,7 @@ // IGNORE_BACKEND: JVM_IR -// TARGET_BACKEND: JVM +// IGNORE_BACKEND: JS_IR +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS, NATIVE fun fn0() {} fun fn1(x: Any) {} @@ -17,7 +19,7 @@ inline fun reifiedAsFailsWithCCE(x: Any, operation: String) { try { x as T } - catch (e: java.lang.ClassCastException) { + catch (e: ClassCastException) { return } catch (e: Throwable) { diff --git a/compiler/testData/codegen/box/casts/mutableCollections/weirdMutableCasts.kt b/compiler/testData/codegen/box/casts/mutableCollections/weirdMutableCasts.kt index 7d6f8448699..750b33c3682 100644 --- a/compiler/testData/codegen/box/casts/mutableCollections/weirdMutableCasts.kt +++ b/compiler/testData/codegen/box/casts/mutableCollections/weirdMutableCasts.kt @@ -1,5 +1,7 @@ // IGNORE_BACKEND: JVM_IR -// TARGET_BACKEND: JVM +// IGNORE_BACKEND: JS_IR +// TODO: muted automatically, investigate should it be ran for JS or not +// IGNORE_BACKEND: JS, NATIVE // WITH_RUNTIME @@ -18,7 +20,7 @@ inline fun asFailsWithCCE(operation: String, cast: () -> Unit) { try { cast() } - catch (e: java.lang.ClassCastException) { + catch (e: ClassCastException) { return } catch (e: Throwable) { @@ -73,7 +75,7 @@ inline fun reifiedAsFailsWithCCE(x: Any, operation: String) { try { x as T } - catch (e: java.lang.ClassCastException) { + catch (e: ClassCastException) { return } catch (e: Throwable) { diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java index 7bbaca9ef37..40dc39ed5f0 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java @@ -2183,6 +2183,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/casts/functions/asFunKBig.kt"); } + @TestMetadata("asFunKSmall.kt") + public void testAsFunKSmall() throws Exception { + runTest("compiler/testData/codegen/box/casts/functions/asFunKSmall.kt"); + } + @TestMetadata("isFunKBig.kt") public void testIsFunKBig() throws Exception { runTest("compiler/testData/codegen/box/casts/functions/isFunKBig.kt"); @@ -2198,6 +2203,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/casts/functions/reifiedAsFunKBig.kt"); } + @TestMetadata("reifiedAsFunKSmall.kt") + public void testReifiedAsFunKSmall() throws Exception { + runTest("compiler/testData/codegen/box/casts/functions/reifiedAsFunKSmall.kt"); + } + @TestMetadata("reifiedIsFunKBig.kt") public void testReifiedIsFunKBig() throws Exception { runTest("compiler/testData/codegen/box/casts/functions/reifiedIsFunKBig.kt"); @@ -2313,6 +2323,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testSafeAsWithMutable() throws Exception { runTest("compiler/testData/codegen/box/casts/mutableCollections/safeAsWithMutable.kt"); } + + @TestMetadata("weirdMutableCasts.kt") + public void testWeirdMutableCasts() throws Exception { + runTest("compiler/testData/codegen/box/casts/mutableCollections/weirdMutableCasts.kt"); + } } } diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 49cda1ff3de..47d8fc8a998 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -2183,6 +2183,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/casts/functions/asFunKBig.kt"); } + @TestMetadata("asFunKSmall.kt") + public void testAsFunKSmall() throws Exception { + runTest("compiler/testData/codegen/box/casts/functions/asFunKSmall.kt"); + } + @TestMetadata("isFunKBig.kt") public void testIsFunKBig() throws Exception { runTest("compiler/testData/codegen/box/casts/functions/isFunKBig.kt"); @@ -2198,6 +2203,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/casts/functions/reifiedAsFunKBig.kt"); } + @TestMetadata("reifiedAsFunKSmall.kt") + public void testReifiedAsFunKSmall() throws Exception { + runTest("compiler/testData/codegen/box/casts/functions/reifiedAsFunKSmall.kt"); + } + @TestMetadata("reifiedIsFunKBig.kt") public void testReifiedIsFunKBig() throws Exception { runTest("compiler/testData/codegen/box/casts/functions/reifiedIsFunKBig.kt"); @@ -2313,6 +2323,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { public void testSafeAsWithMutable() throws Exception { runTest("compiler/testData/codegen/box/casts/mutableCollections/safeAsWithMutable.kt"); } + + @TestMetadata("weirdMutableCasts.kt") + public void testWeirdMutableCasts() throws Exception { + runTest("compiler/testData/codegen/box/casts/mutableCollections/weirdMutableCasts.kt"); + } } }