From 8e6e447d6dba13b861032b198b1d5cd4a0ea0b9b Mon Sep 17 00:00:00 2001 From: Nikolay Lunyak Date: Mon, 15 Jan 2024 12:31:46 +0200 Subject: [PATCH] [FIR] Reproduce KT-64891 ^KT-64891 --- ...ticCompilerTestFE10TestdataTestGenerated.java | 6 ++++++ ...gnosticCompilerFE10TestDataTestGenerated.java | 6 ++++++ ...tTreeOldFrontendDiagnosticsTestGenerated.java | 6 ++++++ ...irPsiOldFrontendDiagnosticsTestGenerated.java | 6 ++++++ .../tests/fixExpressionsInQaSelectors.fir.kt | 16 ++++++++++++++++ .../tests/fixExpressionsInQaSelectors.kt | 16 ++++++++++++++++ .../test/runners/DiagnosticTestGenerated.java | 6 ++++++ 7 files changed, 62 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/fixExpressionsInQaSelectors.fir.kt create mode 100644 compiler/testData/diagnostics/tests/fixExpressionsInQaSelectors.kt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java index 0caf1cd052e..2914410d91c 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java @@ -429,6 +429,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/finalSupertype.kt"); } + @Test + @TestMetadata("fixExpressionsInQaSelectors.kt") + public void testFixExpressionsInQaSelectors() throws Exception { + runTest("compiler/testData/diagnostics/tests/fixExpressionsInQaSelectors.kt"); + } + @Test @TestMetadata("ForRangeConventions.kt") public void testForRangeConventions() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java index 1cb40a16e52..1d29fcf58f7 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java @@ -429,6 +429,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/finalSupertype.kt"); } + @Test + @TestMetadata("fixExpressionsInQaSelectors.kt") + public void testFixExpressionsInQaSelectors() throws Exception { + runTest("compiler/testData/diagnostics/tests/fixExpressionsInQaSelectors.kt"); + } + @Test @TestMetadata("ForRangeConventions.kt") public void testForRangeConventions() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java index aec880e2d3c..71a3023c889 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java @@ -429,6 +429,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/finalSupertype.kt"); } + @Test + @TestMetadata("fixExpressionsInQaSelectors.kt") + public void testFixExpressionsInQaSelectors() throws Exception { + runTest("compiler/testData/diagnostics/tests/fixExpressionsInQaSelectors.kt"); + } + @Test @TestMetadata("ForRangeConventions.kt") public void testForRangeConventions() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java index 361ebd6751d..109c1f20fbd 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java @@ -429,6 +429,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/finalSupertype.kt"); } + @Test + @TestMetadata("fixExpressionsInQaSelectors.kt") + public void testFixExpressionsInQaSelectors() throws Exception { + runTest("compiler/testData/diagnostics/tests/fixExpressionsInQaSelectors.kt"); + } + @Test @TestMetadata("ForRangeConventions.kt") public void testForRangeConventions() throws Exception { diff --git a/compiler/testData/diagnostics/tests/fixExpressionsInQaSelectors.fir.kt b/compiler/testData/diagnostics/tests/fixExpressionsInQaSelectors.fir.kt new file mode 100644 index 00000000000..deecf65de6d --- /dev/null +++ b/compiler/testData/diagnostics/tests/fixExpressionsInQaSelectors.fir.kt @@ -0,0 +1,16 @@ +// ISSUE: KT-64891 + +val b: Int.() -> Int = { 10 } +val Int.b: () -> String get() = { "B" } + +fun main() { + 5.(b)().inv() // should be Int + 5.b().length // should be String +} + +fun id(it: T) = it + +fun rain() { + 5.(b)().inv() + 5.(id(b))().inv() // should be consistent +} diff --git a/compiler/testData/diagnostics/tests/fixExpressionsInQaSelectors.kt b/compiler/testData/diagnostics/tests/fixExpressionsInQaSelectors.kt new file mode 100644 index 00000000000..fa51561d28e --- /dev/null +++ b/compiler/testData/diagnostics/tests/fixExpressionsInQaSelectors.kt @@ -0,0 +1,16 @@ +// ISSUE: KT-64891 + +val b: Int.() -> Int = { 10 } +val Int.b: () -> String get() = { "B" } + +fun main() { + 5.(b)().inv() // should be Int + 5.b().length // should be String +} + +fun id(it: T) = it + +fun rain() { + 5.(b)().inv() + 5.(id(b))().inv() // should be consistent +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 2f37c84b349..ed6f553592e 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -429,6 +429,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/finalSupertype.kt"); } + @Test + @TestMetadata("fixExpressionsInQaSelectors.kt") + public void testFixExpressionsInQaSelectors() throws Exception { + runTest("compiler/testData/diagnostics/tests/fixExpressionsInQaSelectors.kt"); + } + @Test @TestMetadata("ForRangeConventions.kt") public void testForRangeConventions() throws Exception {