From f644f47360a9211ceeadbad3dc87b2aa1f35d8eb Mon Sep 17 00:00:00 2001 From: Roman Artemev Date: Wed, 29 Sep 2021 15:19:09 +0300 Subject: [PATCH] [IR] Add test for KT-47767 --- ...FirBlackBoxInlineCodegenTestGenerated.java | 6 ++++ .../bound/doubleBoundToThis.kt | 33 +++++++++++++++++++ .../BlackBoxInlineCodegenTestGenerated.java | 6 ++++ ...otlinAgainstInlineKotlinTestGenerated.java | 6 ++++ .../IrBlackBoxInlineCodegenTestGenerated.java | 6 ++++ ...otlinAgainstInlineKotlinTestGenerated.java | 6 ++++ ...otlinAgainstInlineKotlinTestGenerated.java | 6 ++++ ...JvmIrAgainstOldBoxInlineTestGenerated.java | 6 ++++ ...JvmOldAgainstIrBoxInlineTestGenerated.java | 6 ++++ .../IrJsCodegenInlineES6TestGenerated.java | 5 +++ .../IrJsCodegenInlineTestGenerated.java | 5 +++ .../JsCodegenInlineTestGenerated.java | 5 +++ 12 files changed, 96 insertions(+) create mode 100644 compiler/testData/codegen/boxInline/callableReference/bound/doubleBoundToThis.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java index 0b906f17fcd..c47743be424 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxInlineCodegenTestGenerated.java @@ -1133,6 +1133,12 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn runTest("compiler/testData/codegen/boxInline/callableReference/bound/classProperty.kt"); } + @Test + @TestMetadata("doubleBoundToThis.kt") + public void testDoubleBoundToThis() throws Exception { + runTest("compiler/testData/codegen/boxInline/callableReference/bound/doubleBoundToThis.kt"); + } + @Test @TestMetadata("emptyLhsFunction.kt") public void testEmptyLhsFunction() throws Exception { diff --git a/compiler/testData/codegen/boxInline/callableReference/bound/doubleBoundToThis.kt b/compiler/testData/codegen/boxInline/callableReference/bound/doubleBoundToThis.kt new file mode 100644 index 00000000000..77cea55ca8f --- /dev/null +++ b/compiler/testData/codegen/boxInline/callableReference/bound/doubleBoundToThis.kt @@ -0,0 +1,33 @@ +// SKIP_SOURCEMAP_REMAPPING +// KT-47767 + +// FILE: 1.kt + +public typealias LoggingFunctionType = () -> T + +inline fun testLoggingPassThough(loggerMethod: LoggingFunctionType): String { + return loggerMethod() + loggerMethod() // if this call is commented the issue doesn't reproduce +} + +// FILE: 2.kt + +class LLoggerTest { + private var i = 0 + fun testDebugTag(): String { + return testLoggingPassThough( + ::forRef + ) + } + private fun forRef(): String { + if (i == 0) { + i++ + return "O" + } + return "K" + } +} + +fun box(): String { + + return LLoggerTest().testDebugTag() +} \ No newline at end of file diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxInlineCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxInlineCodegenTestGenerated.java index 961c32eacc2..e77a02e7a3e 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxInlineCodegenTestGenerated.java @@ -1133,6 +1133,12 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo runTest("compiler/testData/codegen/boxInline/callableReference/bound/classProperty.kt"); } + @Test + @TestMetadata("doubleBoundToThis.kt") + public void testDoubleBoundToThis() throws Exception { + runTest("compiler/testData/codegen/boxInline/callableReference/bound/doubleBoundToThis.kt"); + } + @Test @TestMetadata("emptyLhsFunction.kt") public void testEmptyLhsFunction() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java index 071d0eaa295..612778ef228 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java @@ -1133,6 +1133,12 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi runTest("compiler/testData/codegen/boxInline/callableReference/bound/classProperty.kt"); } + @Test + @TestMetadata("doubleBoundToThis.kt") + public void testDoubleBoundToThis() throws Exception { + runTest("compiler/testData/codegen/boxInline/callableReference/bound/doubleBoundToThis.kt"); + } + @Test @TestMetadata("emptyLhsFunction.kt") public void testEmptyLhsFunction() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java index 76360782f2d..ad36f72741e 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java @@ -1133,6 +1133,12 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli runTest("compiler/testData/codegen/boxInline/callableReference/bound/classProperty.kt"); } + @Test + @TestMetadata("doubleBoundToThis.kt") + public void testDoubleBoundToThis() throws Exception { + runTest("compiler/testData/codegen/boxInline/callableReference/bound/doubleBoundToThis.kt"); + } + @Test @TestMetadata("emptyLhsFunction.kt") public void testEmptyLhsFunction() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java index f7ee1ae1f84..3a1b609984d 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -1133,6 +1133,12 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC runTest("compiler/testData/codegen/boxInline/callableReference/bound/classProperty.kt"); } + @Test + @TestMetadata("doubleBoundToThis.kt") + public void testDoubleBoundToThis() throws Exception { + runTest("compiler/testData/codegen/boxInline/callableReference/bound/doubleBoundToThis.kt"); + } + @Test @TestMetadata("emptyLhsFunction.kt") public void testEmptyLhsFunction() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java index 6da50461d76..0acb274814f 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -1133,6 +1133,12 @@ public class IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends Ab runTest("compiler/testData/codegen/boxInline/callableReference/bound/classProperty.kt"); } + @Test + @TestMetadata("doubleBoundToThis.kt") + public void testDoubleBoundToThis() throws Exception { + runTest("compiler/testData/codegen/boxInline/callableReference/bound/doubleBoundToThis.kt"); + } + @Test @TestMetadata("emptyLhsFunction.kt") public void testEmptyLhsFunction() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java index 28be14f20aa..35bca27c977 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java @@ -1133,6 +1133,12 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO runTest("compiler/testData/codegen/boxInline/callableReference/bound/classProperty.kt"); } + @Test + @TestMetadata("doubleBoundToThis.kt") + public void testDoubleBoundToThis() throws Exception { + runTest("compiler/testData/codegen/boxInline/callableReference/bound/doubleBoundToThis.kt"); + } + @Test @TestMetadata("emptyLhsFunction.kt") public void testEmptyLhsFunction() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxInlineTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxInlineTestGenerated.java index c996170cce8..8731cc5dc53 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxInlineTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmOldAgainstIrBoxInlineTestGenerated.java @@ -1133,6 +1133,12 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst runTest("compiler/testData/codegen/boxInline/callableReference/bound/classProperty.kt"); } + @Test + @TestMetadata("doubleBoundToThis.kt") + public void testDoubleBoundToThis() throws Exception { + runTest("compiler/testData/codegen/boxInline/callableReference/bound/doubleBoundToThis.kt"); + } + @Test @TestMetadata("emptyLhsFunction.kt") public void testEmptyLhsFunction() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java index 56d16b8486e..499e220a4e1 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenInlineES6TestGenerated.java @@ -858,6 +858,11 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline runTest("compiler/testData/codegen/boxInline/callableReference/bound/classProperty.kt"); } + @TestMetadata("doubleBoundToThis.kt") + public void testDoubleBoundToThis() throws Exception { + runTest("compiler/testData/codegen/boxInline/callableReference/bound/doubleBoundToThis.kt"); + } + @TestMetadata("emptyLhsFunction.kt") public void testEmptyLhsFunction() throws Exception { runTest("compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsFunction.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java index 62cd796fc8c..f22e9d7dc2d 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java @@ -858,6 +858,11 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes runTest("compiler/testData/codegen/boxInline/callableReference/bound/classProperty.kt"); } + @TestMetadata("doubleBoundToThis.kt") + public void testDoubleBoundToThis() throws Exception { + runTest("compiler/testData/codegen/boxInline/callableReference/bound/doubleBoundToThis.kt"); + } + @TestMetadata("emptyLhsFunction.kt") public void testEmptyLhsFunction() throws Exception { runTest("compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsFunction.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java index 505ce97983e..953bf08f0ac 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java @@ -858,6 +858,11 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { runTest("compiler/testData/codegen/boxInline/callableReference/bound/classProperty.kt"); } + @TestMetadata("doubleBoundToThis.kt") + public void testDoubleBoundToThis() throws Exception { + runTest("compiler/testData/codegen/boxInline/callableReference/bound/doubleBoundToThis.kt"); + } + @TestMetadata("emptyLhsFunction.kt") public void testEmptyLhsFunction() throws Exception { runTest("compiler/testData/codegen/boxInline/callableReference/bound/emptyLhsFunction.kt");