From 6d2ab92d916c4a47cc79c4a01ed6d3a8af4b2f4c Mon Sep 17 00:00:00 2001 From: Kirill Rakhman Date: Tue, 7 Nov 2023 15:24:41 +0100 Subject: [PATCH] [FIR] Set positioning strategy for UNRESOLVED_REFERENCE_WRONG_RECEIVER --- .../diagnostics/FirDiagnosticsList.kt | 2 +- .../fir/analysis/diagnostics/FirErrors.kt | 2 +- ...sionsImportedFromObjectsUnsupported.fir.kt | 26 ------------------- ...xtensionsImportedFromObjectsUnsupported.kt | 1 + ...recatedModAssignOperatorConventions.fir.kt | 2 +- .../errors/wrongReceiverTypeForInvoke.fir.kt | 2 +- 6 files changed, 5 insertions(+), 30 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt diff --git a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt index bc55b7e6e32..266b9f56b4e 100644 --- a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt +++ b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt @@ -168,7 +168,7 @@ object DIAGNOSTICS_LIST : DiagnosticList("FirErrors") { parameter("currentVersion") } - val UNRESOLVED_REFERENCE_WRONG_RECEIVER by error { + val UNRESOLVED_REFERENCE_WRONG_RECEIVER by error(PositioningStrategy.REFERENCE_BY_QUALIFIED) { parameter>("candidates") } val UNRESOLVED_IMPORT by error(PositioningStrategy.IMPORT_LAST_NAME) { diff --git a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index 6744beb0189..059c057763e 100644 --- a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -172,7 +172,7 @@ object FirErrors { val TYPEALIAS_EXPANSION_DEPRECATION_ERROR by error3, FirBasedSymbol<*>, String>(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED) val TYPEALIAS_EXPANSION_DEPRECATION by warning3, FirBasedSymbol<*>, String>(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED) val API_NOT_AVAILABLE by error2(SourceElementPositioningStrategies.SELECTOR_BY_QUALIFIED) - val UNRESOLVED_REFERENCE_WRONG_RECEIVER by error1>>() + val UNRESOLVED_REFERENCE_WRONG_RECEIVER by error1>>(SourceElementPositioningStrategies.REFERENCE_BY_QUALIFIED) val UNRESOLVED_IMPORT by error1(SourceElementPositioningStrategies.IMPORT_LAST_NAME) val DUPLICATE_PARAMETER_NAME_IN_FUNCTION_TYPE by error0() val MISSING_DEPENDENCY_CLASS by error1(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED) diff --git a/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt b/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt deleted file mode 100644 index 88854f3feff..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt +++ /dev/null @@ -1,26 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_EXPRESSION - -import Obj.ext -import A.Companion.ext2 - -object Obj { - val String.ext: String get() = this -} - -class A { - companion object { - val String.ext2: String get() = this - } -} - -fun test() { - String::ext - Obj::ext - - String::ext2 - A.Companion::ext2 - A::ext2 - - A::foo - A::bar -} diff --git a/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.kt b/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.kt index 86ff3db9f44..3ac2287297a 100644 --- a/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.kt +++ b/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_EXPRESSION import Obj.ext diff --git a/compiler/testData/diagnostics/tests/operatorRem/DeprecatedModAssignOperatorConventions.fir.kt b/compiler/testData/diagnostics/tests/operatorRem/DeprecatedModAssignOperatorConventions.fir.kt index d4c57fb3bdd..9bdc6b0b9a4 100644 --- a/compiler/testData/diagnostics/tests/operatorRem/DeprecatedModAssignOperatorConventions.fir.kt +++ b/compiler/testData/diagnostics/tests/operatorRem/DeprecatedModAssignOperatorConventions.fir.kt @@ -29,7 +29,7 @@ fun test() { oldAndNew %= 1 val onlyOld = OnlyOld() - onlyOld %= 1 + onlyOld %= 1 val onlyNew = OnlyNew() onlyNew %= 1 diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverTypeForInvoke.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverTypeForInvoke.fir.kt index 5b2e5bc1a13..4078bbf5ee0 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverTypeForInvoke.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverTypeForInvoke.fir.kt @@ -5,5 +5,5 @@ fun String.invoke(i: Int) {} fun foo(i: Int) { i(1) - 1(1) + 1(1) }