From d57396225917e99d0cd632afbde3b211889e069a Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Thu, 2 Mar 2017 14:31:30 +0300 Subject: [PATCH] Add test for class delegation with private constructor #KT-16583 Obsolete --- .../delegationWithPrivateConstructor.kt | 17 +++++++++++++ .../delegationWithPrivateConstructor.txt | 24 +++++++++++++++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 6 +++++ .../codegen/BlackBoxCodegenTestGenerated.java | 6 +++++ .../codeInsight/InspectionTestGenerated.java | 3 +-- .../semantics/JsCodegenBoxTestGenerated.java | 6 +++++ 6 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/codegen/light-analysis/delegation/delegationWithPrivateConstructor.txt diff --git a/compiler/testData/codegen/box/delegation/delegationWithPrivateConstructor.kt b/compiler/testData/codegen/box/delegation/delegationWithPrivateConstructor.kt index e69de29bb2d..448cbec7c35 100644 --- a/compiler/testData/codegen/box/delegation/delegationWithPrivateConstructor.kt +++ b/compiler/testData/codegen/box/delegation/delegationWithPrivateConstructor.kt @@ -0,0 +1,17 @@ +class MyObject private constructor(val delegate: Interface) : Interface by delegate { + constructor() : this(Delegate()) +} + +class Delegate : Interface { + override fun greet(): String { + return "OK" + } +} + +private interface Interface { + fun greet(): String +} + +fun box(): String { + return MyObject().greet() +} \ No newline at end of file diff --git a/compiler/testData/codegen/light-analysis/delegation/delegationWithPrivateConstructor.txt b/compiler/testData/codegen/light-analysis/delegation/delegationWithPrivateConstructor.txt new file mode 100644 index 00000000000..fe6ecb8554a --- /dev/null +++ b/compiler/testData/codegen/light-analysis/delegation/delegationWithPrivateConstructor.txt @@ -0,0 +1,24 @@ +@kotlin.Metadata +public final class Delegate { + public method (): void + public @org.jetbrains.annotations.NotNull method greet(): java.lang.String +} + +@kotlin.Metadata +public final class DelegationWithPrivateConstructorKt { + public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String +} + +@kotlin.Metadata +interface Interface { + public abstract @org.jetbrains.annotations.NotNull method greet(): java.lang.String +} + +@kotlin.Metadata +public final class MyObject { + private final @org.jetbrains.annotations.NotNull field delegate: Interface + public method (): void + private method (p0: Interface): void + public final @org.jetbrains.annotations.NotNull method getDelegate(): Interface + public @org.jetbrains.annotations.NotNull method greet(): java.lang.String +} 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 1449f1ee4cf..4314047569c 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 @@ -6653,6 +6653,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } + @TestMetadata("delegationWithPrivateConstructor.kt") + public void testDelegationWithPrivateConstructor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/delegationWithPrivateConstructor.kt"); + doTest(fileName); + } + @TestMetadata("hiddenSuperOverrideIn1.0.kt") public void testHiddenSuperOverrideIn1_0() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 6fdb7c5788f..642468b94b4 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -6653,6 +6653,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } + @TestMetadata("delegationWithPrivateConstructor.kt") + public void testDelegationWithPrivateConstructor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/delegationWithPrivateConstructor.kt"); + doTest(fileName); + } + @TestMetadata("hiddenSuperOverrideIn1.0.kt") public void testHiddenSuperOverrideIn1_0() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt"); diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java index 600319a993f..e739a605cdb 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java @@ -181,8 +181,7 @@ public class InspectionTestGenerated extends AbstractInspectionTest { @TestMetadata("destructuringWrongName/inspectionData/inspections.test") public void testDestructuringWrongName_inspectionData_Inspections_test() throws Exception { - String fileName = - KotlinTestUtils.navigationMetadata("idea/testData/inspections/destructuringWrongName/inspectionData/inspections.test"); + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspections/destructuringWrongName/inspectionData/inspections.test"); doTest(fileName); } 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 42979b3ab6e..7713ff806a2 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 @@ -7506,6 +7506,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); } + @TestMetadata("delegationWithPrivateConstructor.kt") + public void testDelegationWithPrivateConstructor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/delegationWithPrivateConstructor.kt"); + doTest(fileName); + } + @TestMetadata("hiddenSuperOverrideIn1.0.kt") public void testHiddenSuperOverrideIn1_0() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt");