From cb6ec46de12f5b988ddc889aad8836cf3e47eb98 Mon Sep 17 00:00:00 2001 From: Roman Efremov Date: Tue, 17 Oct 2023 10:47:52 +0200 Subject: [PATCH] [FIR] Fix type annotation arguments rendering inside symbols ...in ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT diagnostic. ^KT-62585 --- ...ectActualAnnotationIncompatibilityDiagnosticRenderers.kt | 6 ++++-- .../annotationMatching/annotationArgRendering.fir.kt | 2 +- .../annotationMatching/checkDiagnosticFullText.fir.diag.txt | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirExpectActualAnnotationIncompatibilityDiagnosticRenderers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirExpectActualAnnotationIncompatibilityDiagnosticRenderers.kt index 5af5115dc8f..f89583f3ca3 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirExpectActualAnnotationIncompatibilityDiagnosticRenderers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirExpectActualAnnotationIncompatibilityDiagnosticRenderers.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.diagnostics.rendering.Renderer import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.fir.renderer.ConeIdShortRenderer import org.jetbrains.kotlin.fir.renderer.ConeTypeRenderer +import org.jetbrains.kotlin.fir.renderer.ConeTypeRendererForReadability import org.jetbrains.kotlin.fir.renderer.FirRenderer import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.fir.symbols.SymbolInternals @@ -18,9 +19,10 @@ import org.jetbrains.kotlin.utils.Printer internal object FirExpectActualAnnotationIncompatibilityDiagnosticRenderers { @OptIn(SymbolInternals::class) val SYMBOL_RENDERER = Renderer> { + val idRendererCreator = { ConeIdShortRenderer() } FirRenderer( - typeRenderer = ConeTypeRenderer(), - idRenderer = ConeIdShortRenderer(), + typeRenderer = ConeTypeRendererForReadability(idRendererCreator), + idRenderer = idRendererCreator(), classMemberRenderer = null, bodyRenderer = null, annotationRenderer = null, diff --git a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationArgRendering.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationArgRendering.fir.kt index c4f1eef2b56..71455c009f5 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationArgRendering.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationArgRendering.fir.kt @@ -19,4 +19,4 @@ expect fun onType(): @Ann2("") Any? actual fun stringConcat() {} // Not reported in K1, because supported starting from K2 -actual fun onType(): Any? = null +actual fun onType(): Any? = null diff --git a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.fir.diag.txt b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.fir.diag.txt index 10f20fb9ac0..65032dfacd0 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.fir.diag.txt +++ b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/checkDiagnosticFullText.fir.diag.txt @@ -23,4 +23,4 @@ All annotations from expect 'fun inTypeParam(): Unit' must be present with t All annotations from expect 'val onGetter: String get(): String' must be present with the same arguments on actual 'val onGetter: String get(): String', otherwise they might behave incorrectly. /jvm.kt:(547,553): warning: Annotation `@Ann()` is missing on actual declaration. -All annotations from expect 'fun onType(param: @R|Ann|() Any): Unit' must be present with the same arguments on actual 'fun onType(param: Any): Unit', otherwise they might behave incorrectly. +All annotations from expect 'fun onType(param: @Ann() Any): Unit' must be present with the same arguments on actual 'fun onType(param: Any): Unit', otherwise they might behave incorrectly.