From a9afee77d7c279ca51deb7fa63e176d64bebe9e2 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 8 Jan 2019 19:25:44 +0100 Subject: [PATCH] Add tests for obsolete codegen issues #KT-8203 Obsolete #KT-15950 Obsolete --- .../box/callableReference/bound/arrayGetIntrinsic.kt | 3 +++ .../codegen/box/defaultArguments/useThisInLambda.kt | 7 +++++++ .../kotlin/codegen/BlackBoxCodegenTestGenerated.java | 10 ++++++++++ .../kotlin/codegen/LightAnalysisModeTestGenerated.java | 10 ++++++++++ .../codegen/ir/IrBlackBoxCodegenTestGenerated.java | 10 ++++++++++ .../js/test/semantics/IrJsCodegenBoxTestGenerated.java | 10 ++++++++++ .../js/test/semantics/JsCodegenBoxTestGenerated.java | 10 ++++++++++ 7 files changed, 60 insertions(+) create mode 100644 compiler/testData/codegen/box/callableReference/bound/arrayGetIntrinsic.kt create mode 100644 compiler/testData/codegen/box/defaultArguments/useThisInLambda.kt diff --git a/compiler/testData/codegen/box/callableReference/bound/arrayGetIntrinsic.kt b/compiler/testData/codegen/box/callableReference/bound/arrayGetIntrinsic.kt new file mode 100644 index 00000000000..d81fb9087aa --- /dev/null +++ b/compiler/testData/codegen/box/callableReference/bound/arrayGetIntrinsic.kt @@ -0,0 +1,3 @@ +fun box(): String { + return if ((arrayOf(1, 2, 3)::get)(1) == 2) "OK" else "Fail" +} diff --git a/compiler/testData/codegen/box/defaultArguments/useThisInLambda.kt b/compiler/testData/codegen/box/defaultArguments/useThisInLambda.kt new file mode 100644 index 00000000000..b2f4da36637 --- /dev/null +++ b/compiler/testData/codegen/box/defaultArguments/useThisInLambda.kt @@ -0,0 +1,7 @@ +class X { + fun g(x: () -> Boolean = { super.equals(this) }) = x() +} + +fun box(): String { + return if (X().g()) "OK" else "Fail: false" +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 866ebc5c1f9..e2a2119ed21 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -1766,6 +1766,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/callableReference/bound/array.kt"); } + @TestMetadata("arrayGetIntrinsic.kt") + public void testArrayGetIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/bound/arrayGetIntrinsic.kt"); + } + @TestMetadata("boundJvmFieldInInterfaceCompanion.kt") public void testBoundJvmFieldInInterfaceCompanion() throws Exception { runTest("compiler/testData/codegen/box/callableReference/bound/boundJvmFieldInInterfaceCompanion.kt"); @@ -8625,6 +8630,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/defaultArguments/superCallCheck.kt"); } + @TestMetadata("useThisInLambda.kt") + public void testUseThisInLambda() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/useThisInLambda.kt"); + } + @TestMetadata("compiler/testData/codegen/box/defaultArguments/constructor") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index a4cf7eb5bfb..d9ae3206154 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -1766,6 +1766,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/callableReference/bound/array.kt"); } + @TestMetadata("arrayGetIntrinsic.kt") + public void testArrayGetIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/bound/arrayGetIntrinsic.kt"); + } + @TestMetadata("boundJvmFieldInInterfaceCompanion.kt") public void testBoundJvmFieldInInterfaceCompanion() throws Exception { runTest("compiler/testData/codegen/box/callableReference/bound/boundJvmFieldInInterfaceCompanion.kt"); @@ -8625,6 +8630,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/defaultArguments/superCallCheck.kt"); } + @TestMetadata("useThisInLambda.kt") + public void testUseThisInLambda() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/useThisInLambda.kt"); + } + @TestMetadata("compiler/testData/codegen/box/defaultArguments/constructor") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 42dc70b1766..0e3e072c15d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -1766,6 +1766,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/callableReference/bound/array.kt"); } + @TestMetadata("arrayGetIntrinsic.kt") + public void testArrayGetIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/bound/arrayGetIntrinsic.kt"); + } + @TestMetadata("boundJvmFieldInInterfaceCompanion.kt") public void testBoundJvmFieldInInterfaceCompanion() throws Exception { runTest("compiler/testData/codegen/box/callableReference/bound/boundJvmFieldInInterfaceCompanion.kt"); @@ -8625,6 +8630,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/defaultArguments/superCallCheck.kt"); } + @TestMetadata("useThisInLambda.kt") + public void testUseThisInLambda() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/useThisInLambda.kt"); + } + @TestMetadata("compiler/testData/codegen/box/defaultArguments/constructor") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) 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 0307631cb16..c6ab9c1f290 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 @@ -1311,6 +1311,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/callableReference/bound/array.kt"); } + @TestMetadata("arrayGetIntrinsic.kt") + public void testArrayGetIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/bound/arrayGetIntrinsic.kt"); + } + @TestMetadata("coercionToUnit.kt") public void testCoercionToUnit() throws Exception { runTest("compiler/testData/codegen/box/callableReference/bound/coercionToUnit.kt"); @@ -6580,6 +6585,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/defaultArguments/simpleFromOtherFile.kt"); } + @TestMetadata("useThisInLambda.kt") + public void testUseThisInLambda() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/useThisInLambda.kt"); + } + @TestMetadata("compiler/testData/codegen/box/defaultArguments/constructor") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) 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 0994c18c23e..52d809421c6 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 @@ -1311,6 +1311,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/callableReference/bound/array.kt"); } + @TestMetadata("arrayGetIntrinsic.kt") + public void testArrayGetIntrinsic() throws Exception { + runTest("compiler/testData/codegen/box/callableReference/bound/arrayGetIntrinsic.kt"); + } + @TestMetadata("coercionToUnit.kt") public void testCoercionToUnit() throws Exception { runTest("compiler/testData/codegen/box/callableReference/bound/coercionToUnit.kt"); @@ -7625,6 +7630,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/defaultArguments/simpleFromOtherFile.kt"); } + @TestMetadata("useThisInLambda.kt") + public void testUseThisInLambda() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/useThisInLambda.kt"); + } + @TestMetadata("compiler/testData/codegen/box/defaultArguments/constructor") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)