[FIR] Fix type annotation arguments rendering inside symbols

...in ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT diagnostic.

^KT-62585
This commit is contained in:
Roman Efremov
2023-10-17 10:47:52 +02:00
committed by Space Team
parent b3467353b2
commit cb6ec46de1
3 changed files with 6 additions and 4 deletions
@@ -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<FirBasedSymbol<*>> {
val idRendererCreator = { ConeIdShortRenderer() }
FirRenderer(
typeRenderer = ConeTypeRenderer(),
idRenderer = ConeIdShortRenderer(),
typeRenderer = ConeTypeRendererForReadability(idRendererCreator),
idRenderer = idRendererCreator(),
classMemberRenderer = null,
bodyRenderer = null,
annotationRenderer = null,
@@ -19,4 +19,4 @@ expect fun onType(): @Ann2("") Any?
<!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT("fun stringConcat(): Unit; fun stringConcat(): Unit; Annotation `@Ann2(s = String(1).R|kotlin/String.plus|(String(2)))` is missing on actual declaration")!>stringConcat<!>() {}<!>
// Not reported in K1, because supported starting from K2
<!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT("fun onType(): @R|Ann2|(s = String()) Any?; fun onType(): Any?; Annotation `@Ann2(s = String())` is missing on actual declaration")!>onType<!>(): Any? = null<!>
<!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT("fun onType(): @Ann2(...) Any?; fun onType(): Any?; Annotation `@Ann2(s = String())` is missing on actual declaration")!>onType<!>(): Any? = null<!>
@@ -23,4 +23,4 @@ All annotations from expect 'fun <T> 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.