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 f89583f3ca3..44a3072c813 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 @@ -7,10 +7,7 @@ package org.jetbrains.kotlin.fir.analysis.diagnostics 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.renderer.* import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.fir.symbols.SymbolInternals import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualAnnotationsIncompatibilityType @@ -54,6 +51,7 @@ internal object FirExpectActualAnnotationIncompatibilityDiagnosticRenderers { return FirRenderer( typeRenderer = ConeTypeRenderer(), idRenderer = ConeIdShortRenderer(), + referencedSymbolRenderer = FirIdRendererBasedSymbolRenderer(), ).renderElementAsString(ann, trim = true) } } \ No newline at end of file diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/renderer/FirIdRendererBasedSymbolRenderer.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/renderer/FirIdRendererBasedSymbolRenderer.kt new file mode 100644 index 00000000000..56301fe72d1 --- /dev/null +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/renderer/FirIdRendererBasedSymbolRenderer.kt @@ -0,0 +1,20 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.fir.renderer + +import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol + +class FirIdRendererBasedSymbolRenderer : FirSymbolRenderer() { + override fun printReference(symbol: FirBasedSymbol<*>) { + when (symbol) { + is FirCallableSymbol<*> -> components.idRenderer.renderCallableId(symbol.callableId) + is FirClassLikeSymbol<*> -> components.idRenderer.renderClassId(symbol.classId) + else -> super.printReference(symbol) + } + } +} \ No newline at end of file diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/renderer/FirSymbolRenderer.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/renderer/FirSymbolRenderer.kt index d291c1e7d9b..33a6ccc0c7b 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/renderer/FirSymbolRenderer.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/renderer/FirSymbolRenderer.kt @@ -14,7 +14,7 @@ open class FirSymbolRenderer { internal lateinit var components: FirRendererComponents protected val printer get() = components.printer - fun printReference(symbol: FirBasedSymbol<*>) { + open fun printReference(symbol: FirBasedSymbol<*>) { printer.print(renderReference(symbol)) } diff --git a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationArgRendering.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationArgRendering.fir.kt index 445ab9ad16c..84da7945c12 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationArgRendering.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationArgRendering.fir.kt @@ -14,9 +14,9 @@ expect fun onType(): @Ann2("") Any? // MODULE: m1-jvm()()(m1-common) // FILE: jvm.kt -actual annotation class Ann +actual annotation class Ann -actual fun stringConcat() {} +actual fun stringConcat() {} // Not reported in K1, because supported starting from K2 actual fun onType(): Any? = null