From 4188bca9b8abd3b4da5b68b67c4182cdfc733b6b Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 26 Apr 2023 14:53:58 +0200 Subject: [PATCH] K1: don't report RECEIVER_TYPE_MISMATCH with -ProperTypeInferenceConstraintProcessing Related to KT-55056 #KT-57854 Fixed --- .../DiagnosticReporterByTrackingStrategy.kt | 10 ++++++---- .../receiverTypeMismatch_withoutProper.fir.kt | 16 ---------------- .../receiverTypeMismatch_withoutProper.kt | 3 ++- 3 files changed, 8 insertions(+), 21 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.fir.kt diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt index 50556a6bc88..6faff3e14fb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt @@ -629,11 +629,13 @@ class DiagnosticReporterByTrackingStrategy( val expression = argument.psiExpression ?: run { val psiCall = (selectorCall as? PSIKotlinCall)?.psiCall ?: psiKotlinCall.psiCall - report( - RECEIVER_TYPE_MISMATCH.on( - psiCall.calleeExpression ?: psiCall.callElement, error.upperKotlinType, error.lowerKotlinType + if (context.languageVersionSettings.supportsFeature(LanguageFeature.ProperTypeInferenceConstraintsProcessing)) { + report( + RECEIVER_TYPE_MISMATCH.on( + psiCall.calleeExpression ?: psiCall.callElement, error.upperKotlinType, error.lowerKotlinType + ) ) - ) + } return } diff --git a/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.fir.kt b/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.fir.kt deleted file mode 100644 index b19df3a4ad1..00000000000 --- a/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ -// 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 index 0ca53694e1e..93ee00da39f 100644 --- a/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.kt +++ b/compiler/testData/diagnostics/tests/inference/receiverTypeMismatch_withoutProper.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // LANGUAGE: -ProperTypeInferenceConstraintsProcessing // FILE: Configuration.java @@ -11,6 +12,6 @@ public class State>> {} // FILE: Main.kt fun setup(configuration: Configuration<*>) { configuration.apply { - directoryPath + directoryPath } }