[AA FIR] correctly restore declaration with annotation with argument inside some type from symbol pointer

ConeAttributes can have some non-stable info, so we shouldn't render it

Also reduce resolve from IMPLICIT_TYPES_BODY_RESOLVE to TYPES where it is possible

^KT-58141 Fixed
This commit is contained in:
Dmitrii Gridin
2023-04-20 17:43:37 +02:00
committed by Space Team
parent 866e8a26c7
commit 6b3e49e824
9 changed files with 92 additions and 7 deletions
@@ -0,0 +1,16 @@
/*
* 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.types.ConeAttributes
abstract class ConeAttributeRenderer {
abstract fun render(attributes: ConeAttributes): String
object ToString : ConeAttributeRenderer() {
override fun render(attributes: ConeAttributes): String = attributes.joinToString(separator = " ", postfix = " ") { it.toString() }
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/
@@ -12,6 +12,7 @@ open class ConeTypeRenderer {
lateinit var builder: StringBuilder
lateinit var idRenderer: ConeIdRenderer
var attributeRenderer: ConeAttributeRenderer = ConeAttributeRenderer.ToString
open fun renderAsPossibleFunctionType(
type: ConeKotlinType,
@@ -180,7 +181,7 @@ open class ConeTypeRenderer {
private fun ConeKotlinType.renderAttributes() {
if (!attributes.any()) return
builder.append(attributes.joinToString(" ", postfix = " ") { it.toString() })
builder.append(attributeRenderer.render(attributes))
}
private fun ConeTypeProjection.render() {