From 34c17e2bed078e0c9481176167a25eb8e3ca2f60 Mon Sep 17 00:00:00 2001 From: Roman Artemev Date: Thu, 12 Mar 2020 12:54:04 +0300 Subject: [PATCH] [KLIB] Add regression to about VarAsFun type parameter leak --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 ++ .../varAsFunctionCall.kt | 15 ++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 ++ .../LightAnalysisModeTestGenerated.java | 50 +++++++++++++++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 5 ++ .../IrJsCodegenBoxTestGenerated.java | 5 ++ .../semantics/JsCodegenBoxTestGenerated.java | 5 ++ 7 files changed, 90 insertions(+) create mode 100644 compiler/testData/codegen/box/ir/serializationRegressions/varAsFunctionCall.kt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 865941fac79..ea3614ece42 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -13777,6 +13777,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT public void testUseImportedMember() throws Exception { runTest("compiler/testData/codegen/box/ir/serializationRegressions/useImportedMember.kt"); } + + @TestMetadata("varAsFunctionCall.kt") + public void testVarAsFunctionCall() throws Exception { + runTest("compiler/testData/codegen/box/ir/serializationRegressions/varAsFunctionCall.kt"); + } } } diff --git a/compiler/testData/codegen/box/ir/serializationRegressions/varAsFunctionCall.kt b/compiler/testData/codegen/box/ir/serializationRegressions/varAsFunctionCall.kt new file mode 100644 index 00000000000..39562c9b37d --- /dev/null +++ b/compiler/testData/codegen/box/ir/serializationRegressions/varAsFunctionCall.kt @@ -0,0 +1,15 @@ +// IGNORE_BACKEND_FIR: JVM_IR +// MODULE: lib +// FILE: l1.kt + +val T.z + get() = { x: T -> this } + +// FILE: l2.kt + +fun test(ok: String, fail: String) = ok.z(fail) + +// MODULE: main(lib) +// FILE: main.kt + +fun box() = test("OK", "FAIL") \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 71bb2520bd0..a394dfa9eaa 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -14922,6 +14922,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testUseImportedMember() throws Exception { runTest("compiler/testData/codegen/box/ir/serializationRegressions/useImportedMember.kt"); } + + @TestMetadata("varAsFunctionCall.kt") + public void testVarAsFunctionCall() throws Exception { + runTest("compiler/testData/codegen/box/ir/serializationRegressions/varAsFunctionCall.kt"); + } } } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index f87cca93b3c..59e42e6dc3b 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -9592,6 +9592,21 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/defaultArguments/function/funInTraitChain.kt"); } + @TestMetadata("kt15971.kt") + public void ignoreKt15971() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/function/kt15971.kt"); + } + + @TestMetadata("kt15971_2.kt") + public void ignoreKt15971_2() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/function/kt15971_2.kt"); + } + + @TestMetadata("kt15971_3.kt") + public void ignoreKt15971_3() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/function/kt15971_3.kt"); + } + private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } @@ -9680,6 +9695,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt"); } + @TestMetadata("kt36188.kt") + public void testKt36188() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/function/kt36188.kt"); + } + + @TestMetadata("kt36188_2.kt") + public void testKt36188_2() throws Exception { + runTest("compiler/testData/codegen/box/defaultArguments/function/kt36188_2.kt"); + } + @TestMetadata("kt5232.kt") public void testKt5232() throws Exception { runTest("compiler/testData/codegen/box/defaultArguments/function/kt5232.kt"); @@ -14897,6 +14922,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes public void testUseImportedMember() throws Exception { runTest("compiler/testData/codegen/box/ir/serializationRegressions/useImportedMember.kt"); } + + @TestMetadata("varAsFunctionCall.kt") + public void testVarAsFunctionCall() throws Exception { + runTest("compiler/testData/codegen/box/ir/serializationRegressions/varAsFunctionCall.kt"); + } } } @@ -19396,11 +19426,21 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/primitiveTypes/number.kt"); } + @TestMetadata("numberEqualsHashCodeToString.kt") + public void testNumberEqualsHashCodeToString() throws Exception { + runTest("compiler/testData/codegen/box/primitiveTypes/numberEqualsHashCodeToString.kt"); + } + @TestMetadata("rangeTo.kt") public void testRangeTo() throws Exception { runTest("compiler/testData/codegen/box/primitiveTypes/rangeTo.kt"); } + @TestMetadata("stringEqualsHashCodeToString.kt") + public void testStringEqualsHashCodeToString() throws Exception { + runTest("compiler/testData/codegen/box/primitiveTypes/stringEqualsHashCodeToString.kt"); + } + @TestMetadata("substituteIntForGeneric.kt") public void testSubstituteIntForGeneric() throws Exception { runTest("compiler/testData/codegen/box/primitiveTypes/substituteIntForGeneric.kt"); @@ -21963,6 +22003,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/ranges/unsigned/kt35004.kt"); } + @TestMetadata("kt36953.kt") + public void testKt36953() throws Exception { + runTest("compiler/testData/codegen/box/ranges/unsigned/kt36953.kt"); + } + + @TestMetadata("kt36953_continue.kt") + public void testKt36953_continue() throws Exception { + runTest("compiler/testData/codegen/box/ranges/unsigned/kt36953_continue.kt"); + } + @TestMetadata("compiler/testData/codegen/box/ranges/unsigned/expression") @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 528efbe21d4..ba22a7fac26 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -13777,6 +13777,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes public void testUseImportedMember() throws Exception { runTest("compiler/testData/codegen/box/ir/serializationRegressions/useImportedMember.kt"); } + + @TestMetadata("varAsFunctionCall.kt") + public void testVarAsFunctionCall() throws Exception { + runTest("compiler/testData/codegen/box/ir/serializationRegressions/varAsFunctionCall.kt"); + } } } diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index d1fe6475808..6be7d7f1732 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -11937,6 +11937,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testUseImportedMember() throws Exception { runTest("compiler/testData/codegen/box/ir/serializationRegressions/useImportedMember.kt"); } + + @TestMetadata("varAsFunctionCall.kt") + public void testVarAsFunctionCall() throws Exception { + runTest("compiler/testData/codegen/box/ir/serializationRegressions/varAsFunctionCall.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 4f31c8a90c3..0fc9f468107 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 @@ -12002,6 +12002,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { public void testUseImportedMember() throws Exception { runTest("compiler/testData/codegen/box/ir/serializationRegressions/useImportedMember.kt"); } + + @TestMetadata("varAsFunctionCall.kt") + public void testVarAsFunctionCall() throws Exception { + runTest("compiler/testData/codegen/box/ir/serializationRegressions/varAsFunctionCall.kt"); + } } }