From fe979cc8225828456afd20381a0e05b748ec2862 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Fri, 13 Oct 2023 13:26:09 +0200 Subject: [PATCH] K2: add source range test with extension lambda call This test is equivalent to IDE debugger test testNoParameterExtensionLambdaArgumentCallInInline3, which changes behavior due to previous commit --- .../ir/FirLightTreeJvmIrSourceRangesTestGenerated.java | 6 ++++++ .../runners/ir/FirPsiJvmIrSourceRangesTestGenerated.java | 6 ++++++ .../testData/ir/sourceRanges/extensionLambdaCall.fir.txt | 7 +++++++ compiler/testData/ir/sourceRanges/extensionLambdaCall.kt | 4 ++++ compiler/testData/ir/sourceRanges/extensionLambdaCall.txt | 7 +++++++ .../runners/ir/ClassicJvmIrSourceRangesTestGenerated.java | 6 ++++++ 6 files changed, 36 insertions(+) create mode 100644 compiler/testData/ir/sourceRanges/extensionLambdaCall.fir.txt create mode 100644 compiler/testData/ir/sourceRanges/extensionLambdaCall.kt create mode 100644 compiler/testData/ir/sourceRanges/extensionLambdaCall.txt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrSourceRangesTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrSourceRangesTestGenerated.java index a1ff3e1ae9e..9b74db73e53 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrSourceRangesTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirLightTreeJvmIrSourceRangesTestGenerated.java @@ -49,6 +49,12 @@ public class FirLightTreeJvmIrSourceRangesTestGenerated extends AbstractFirLight runTest("compiler/testData/ir/sourceRanges/elvis.kt"); } + @Test + @TestMetadata("extensionLambdaCall.kt") + public void testExtensionLambdaCall() throws Exception { + runTest("compiler/testData/ir/sourceRanges/extensionLambdaCall.kt"); + } + @Test @TestMetadata("kt17108.kt") public void testKt17108() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrSourceRangesTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrSourceRangesTestGenerated.java index 286e604931a..bb051c10832 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrSourceRangesTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrSourceRangesTestGenerated.java @@ -49,6 +49,12 @@ public class FirPsiJvmIrSourceRangesTestGenerated extends AbstractFirPsiJvmIrSou runTest("compiler/testData/ir/sourceRanges/elvis.kt"); } + @Test + @TestMetadata("extensionLambdaCall.kt") + public void testExtensionLambdaCall() throws Exception { + runTest("compiler/testData/ir/sourceRanges/extensionLambdaCall.kt"); + } + @Test @TestMetadata("kt17108.kt") public void testKt17108() throws Exception { diff --git a/compiler/testData/ir/sourceRanges/extensionLambdaCall.fir.txt b/compiler/testData/ir/sourceRanges/extensionLambdaCall.fir.txt new file mode 100644 index 00000000000..4804d064a5f --- /dev/null +++ b/compiler/testData/ir/sourceRanges/extensionLambdaCall.fir.txt @@ -0,0 +1,7 @@ +@0:0..4:0 FILE fqName: fileName:/extensionLambdaCall.kt + @0:0..3:1 FUN name:lookAtMe visibility:public modality:FINAL <> (f:@[ExtensionFunctionType] kotlin.Function1) returnType:kotlin.Unit + @0:13..33 VALUE_PARAMETER name:f index:0 type:@[ExtensionFunctionType] kotlin.Function1 + @0:35..3:1 BLOCK_BODY + @1:4..2:15 CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.Unit origin=INVOKE + @2:12..13 GET_VAR 'f: @[ExtensionFunctionType] kotlin.Function1 declared in .lookAtMe' type=@[ExtensionFunctionType] kotlin.Function1 origin=VARIABLE_AS_FUNCTION + @1:4..9 CONST String type=kotlin.String value="123" diff --git a/compiler/testData/ir/sourceRanges/extensionLambdaCall.kt b/compiler/testData/ir/sourceRanges/extensionLambdaCall.kt new file mode 100644 index 00000000000..d021c456739 --- /dev/null +++ b/compiler/testData/ir/sourceRanges/extensionLambdaCall.kt @@ -0,0 +1,4 @@ +fun lookAtMe(f: String.() -> Unit) { + "123". + f() +} diff --git a/compiler/testData/ir/sourceRanges/extensionLambdaCall.txt b/compiler/testData/ir/sourceRanges/extensionLambdaCall.txt new file mode 100644 index 00000000000..1fee2cc3768 --- /dev/null +++ b/compiler/testData/ir/sourceRanges/extensionLambdaCall.txt @@ -0,0 +1,7 @@ +@0:0..4:0 FILE fqName: fileName:/extensionLambdaCall.kt + @0:0..3:1 FUN name:lookAtMe visibility:public modality:FINAL <> (f:@[ExtensionFunctionType] kotlin.Function1) returnType:kotlin.Unit + @0:13..33 VALUE_PARAMETER name:f index:0 type:@[ExtensionFunctionType] kotlin.Function1 + @0:35..3:1 BLOCK_BODY + @2:12..15 CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.Unit origin=INVOKE + @2:12..13 GET_VAR 'f: @[ExtensionFunctionType] kotlin.Function1 declared in .lookAtMe' type=@[ExtensionFunctionType] kotlin.Function1 origin=VARIABLE_AS_FUNCTION + @1:5..8 CONST String type=kotlin.String value="123" diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrSourceRangesTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrSourceRangesTestGenerated.java index d1740f5d487..ab21855765c 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrSourceRangesTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/ClassicJvmIrSourceRangesTestGenerated.java @@ -49,6 +49,12 @@ public class ClassicJvmIrSourceRangesTestGenerated extends AbstractClassicJvmIrS runTest("compiler/testData/ir/sourceRanges/elvis.kt"); } + @Test + @TestMetadata("extensionLambdaCall.kt") + public void testExtensionLambdaCall() throws Exception { + runTest("compiler/testData/ir/sourceRanges/extensionLambdaCall.kt"); + } + @Test @TestMetadata("kt17108.kt") public void testKt17108() throws Exception {