From 1f643ddce835c2ae3fc330abc2111ecff8f81755 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Tue, 24 Oct 2017 19:55:23 +0300 Subject: [PATCH] JS: add test to prove that KT-11910 is not reproducible anymore --- .../subclassingExtensionReceiverClass.kt | 19 +++++++++++++++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 12 ++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 12 ++++++++++++ .../LightAnalysisModeTestGenerated.java | 12 ++++++++++++ .../semantics/JsCodegenBoxTestGenerated.java | 6 ++++++ 5 files changed, 61 insertions(+) create mode 100644 compiler/testData/codegen/box/localClasses/subclassingExtensionReceiverClass.kt diff --git a/compiler/testData/codegen/box/localClasses/subclassingExtensionReceiverClass.kt b/compiler/testData/codegen/box/localClasses/subclassingExtensionReceiverClass.kt new file mode 100644 index 00000000000..3e6dafc1749 --- /dev/null +++ b/compiler/testData/codegen/box/localClasses/subclassingExtensionReceiverClass.kt @@ -0,0 +1,19 @@ +// IGNORE_BACKEND: JVM + +class A(val x: String) { + open inner class AB(val y: String) { + fun bar() = x + y + } +} + +fun A.foo(u: String, v: String, w: String): A.AB { + class FooC(z: String) : A.AB("$z$v$w") + return FooC(u) +} + +fun box(): String { + val r = A("1").foo("2", "3", "4").bar() + if (r != "1234") return "fail: $r" + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 00e9c4942d9..749201f727e 100644 --- a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -11252,6 +11252,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } + @TestMetadata("subclassingExtensionReceiverClass.kt") + public void testSubclassingExtensionReceiverClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/subclassingExtensionReceiverClass.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + @TestMetadata("withclosure.kt") public void testWithclosure() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/withclosure.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index b6aca259fc9..819a1adf761 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -11252,6 +11252,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } + @TestMetadata("subclassingExtensionReceiverClass.kt") + public void testSubclassingExtensionReceiverClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/subclassingExtensionReceiverClass.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + @TestMetadata("withclosure.kt") public void testWithclosure() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/withclosure.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 6aa9a4fe431..57c4e624606 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -11104,6 +11104,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); } + @TestMetadata("subclassingExtensionReceiverClass.kt") + public void ignoreSubclassingExtensionReceiverClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/subclassingExtensionReceiverClass.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + public void testAllFilesPresentInLocalClasses() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/localClasses"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } 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 89b41755d5d..490a6df830c 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 @@ -12470,6 +12470,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { doTest(fileName); } + @TestMetadata("subclassingExtensionReceiverClass.kt") + public void testSubclassingExtensionReceiverClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/subclassingExtensionReceiverClass.kt"); + doTest(fileName); + } + @TestMetadata("withclosure.kt") public void testWithclosure() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/localClasses/withclosure.kt");