From 04812332f9b7dcc19d93ee319eb1385a48f9179a Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 26 Apr 2023 14:46:32 +0200 Subject: [PATCH] FE: add tests reproducing KT-57854 --- ...ticCompilerTestFE10TestdataTestGenerated.java | 12 ++++++++++++ ...gnosticCompilerFE10TestDataTestGenerated.java | 12 ++++++++++++ ...tTreeOldFrontendDiagnosticsTestGenerated.java | 12 ++++++++++++ ...irPsiOldFrontendDiagnosticsTestGenerated.java | 12 ++++++++++++ .../receiverTypeMismatch_withProper.fir.kt | 16 ++++++++++++++++ .../inference/receiverTypeMismatch_withProper.kt | 16 ++++++++++++++++ .../receiverTypeMismatch_withoutProper.fir.kt | 16 ++++++++++++++++ .../receiverTypeMismatch_withoutProper.kt | 16 ++++++++++++++++ .../test/runners/DiagnosticTestGenerated.java | 12 ++++++++++++ 9 files changed, 124 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withProper.fir.kt create mode 100644 compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withProper.kt create mode 100644 compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.fir.kt create mode 100644 compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.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 3d687ed9b0c..938733a467e 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 @@ -14882,6 +14882,18 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt"); } + @Test + @TestMetadata("receiverTypeMismatch_withProper.kt") + public void testReceiverTypeMismatch_withProper() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withProper.kt"); + } + + @Test + @TestMetadata("receiverTypeMismatch_withoutProper.kt") + public void testReceiverTypeMismatch_withoutProper() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.kt"); + } + @Test @TestMetadata("reportAboutUnresolvedReferenceAsUnresolved.kt") public void testReportAboutUnresolvedReferenceAsUnresolved() 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 ed1ab16824f..8f8fca13681 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 @@ -14882,6 +14882,18 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt"); } + @Test + @TestMetadata("receiverTypeMismatch_withProper.kt") + public void testReceiverTypeMismatch_withProper() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withProper.kt"); + } + + @Test + @TestMetadata("receiverTypeMismatch_withoutProper.kt") + public void testReceiverTypeMismatch_withoutProper() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.kt"); + } + @Test @TestMetadata("reportAboutUnresolvedReferenceAsUnresolved.kt") public void testReportAboutUnresolvedReferenceAsUnresolved() 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 e86765bf67d..f1dd144470f 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 @@ -14882,6 +14882,18 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt"); } + @Test + @TestMetadata("receiverTypeMismatch_withProper.kt") + public void testReceiverTypeMismatch_withProper() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withProper.kt"); + } + + @Test + @TestMetadata("receiverTypeMismatch_withoutProper.kt") + public void testReceiverTypeMismatch_withoutProper() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.kt"); + } + @Test @TestMetadata("reportAboutUnresolvedReferenceAsUnresolved.kt") public void testReportAboutUnresolvedReferenceAsUnresolved() 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 b15d2b12006..b18f4c319c3 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 @@ -14888,6 +14888,18 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt"); } + @Test + @TestMetadata("receiverTypeMismatch_withProper.kt") + public void testReceiverTypeMismatch_withProper() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withProper.kt"); + } + + @Test + @TestMetadata("receiverTypeMismatch_withoutProper.kt") + public void testReceiverTypeMismatch_withoutProper() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.kt"); + } + @Test @TestMetadata("reportAboutUnresolvedReferenceAsUnresolved.kt") public void testReportAboutUnresolvedReferenceAsUnresolved() throws Exception { diff --git a/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withProper.fir.kt b/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withProper.fir.kt new file mode 100644 index 00000000000..306e434977a --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withProper.fir.kt @@ -0,0 +1,16 @@ +// LANGUAGE: +ProperTypeInferenceConstraintsProcessing + +// FILE: Configuration.java +public class Configuration>> { + public String getDirectoryPath() { return ""; } +} + +// FILE: State.java +public class State>> {} + +// FILE: Main.kt +fun setup(configuration: Configuration<*>) { + configuration.apply { + directoryPath + } +} diff --git a/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withProper.kt b/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withProper.kt new file mode 100644 index 00000000000..b89997a64ad --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withProper.kt @@ -0,0 +1,16 @@ +// LANGUAGE: +ProperTypeInferenceConstraintsProcessing + +// FILE: Configuration.java +public class Configuration>> { + public String getDirectoryPath() { return ""; } +} + +// FILE: State.java +public class State>> {} + +// FILE: Main.kt +fun setup(configuration: Configuration<*>) { + configuration.apply { + directoryPath + } +} diff --git a/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.fir.kt b/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.fir.kt new file mode 100644 index 00000000000..b19df3a4ad1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.fir.kt @@ -0,0 +1,16 @@ +// LANGUAGE: -ProperTypeInferenceConstraintsProcessing + +// FILE: Configuration.java +public class Configuration>> { + public String getDirectoryPath() { return ""; } +} + +// FILE: State.java +public class State>> {} + +// FILE: Main.kt +fun setup(configuration: Configuration<*>) { + configuration.apply { + directoryPath + } +} diff --git a/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.kt b/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.kt new file mode 100644 index 00000000000..0ca53694e1e --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.kt @@ -0,0 +1,16 @@ +// LANGUAGE: -ProperTypeInferenceConstraintsProcessing + +// FILE: Configuration.java +public class Configuration>> { + public String getDirectoryPath() { return ""; } +} + +// FILE: State.java +public class State>> {} + +// FILE: Main.kt +fun setup(configuration: Configuration<*>) { + configuration.apply { + directoryPath + } +} 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 25491cb1086..b83154bc6a4 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 @@ -14888,6 +14888,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt"); } + @Test + @TestMetadata("receiverTypeMismatch_withProper.kt") + public void testReceiverTypeMismatch_withProper() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withProper.kt"); + } + + @Test + @TestMetadata("receiverTypeMismatch_withoutProper.kt") + public void testReceiverTypeMismatch_withoutProper() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.kt"); + } + @Test @TestMetadata("reportAboutUnresolvedReferenceAsUnresolved.kt") public void testReportAboutUnresolvedReferenceAsUnresolved() throws Exception {