From 2fb79bf0b1e6b302132542adcc9c46ccfcb3031d Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 14 Mar 2023 13:25:16 +0100 Subject: [PATCH] K1: don't report InferredIntoDeclaredUpperBound on non-physical element #KT-56169 Fixed --- .../resolve/calls/DiagnosticReporterByTrackingStrategy.kt | 2 +- .../builderInference/buildListToUpperBoundInLazy.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 456acb5adb8..f1c48ecd0a6 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/DiagnosticReporterByTrackingStrategy.kt @@ -584,7 +584,7 @@ class DiagnosticReporterByTrackingStrategy( val expression = if (psiCall is CallTransformer.CallForImplicitInvoke) { psiCall.outerCall.calleeExpression } else { - psiCall.calleeExpression + psiCall.calleeExpression?.takeIf { it.isPhysical } ?: psiCall.callElement } ?: return val typeVariable = error.typeVariable as? TypeVariableFromCallableDescriptor ?: return diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundInLazy.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundInLazy.kt index 7dbcfc2bce1..cf98dd1421d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundInLazy.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundInLazy.kt @@ -28,7 +28,7 @@ internal class TowerDataElementsForName2() { } internal class TowerDataElementsForName3() { - val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) { + val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) { @OptIn(ExperimentalStdlibApi::class) buildList l1@ { for (i in lastIndex downTo 0) { @@ -43,7 +43,7 @@ internal class TowerDataElementsForName3() { } } } - } + } } internal class TowerDataElementsForName4() {