[FIR] Make rendering of cone type attributes in diagnostic messages opt-in per attribute
#KT-63228 Fixed
This commit is contained in:
committed by
Space Team
parent
2b53e4ecbd
commit
d5ed922208
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.fir.renderer
|
||||
|
||||
import org.jetbrains.kotlin.fir.types.ConeAttribute
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
|
||||
|
||||
abstract class ConeAttributeRenderer {
|
||||
abstract fun render(attributes: Iterable<ConeAttribute<*>>): String
|
||||
@@ -17,6 +18,6 @@ abstract class ConeAttributeRenderer {
|
||||
|
||||
object ForReadability : ConeAttributeRenderer() {
|
||||
override fun render(attributes: Iterable<ConeAttribute<*>>): String =
|
||||
attributes.joinToString(separator = " ", postfix = " ") { it.renderForReadability() }
|
||||
attributes.mapNotNull { it.renderForReadability() }.ifNotEmpty { joinToString(separator = " ", postfix = " ") } ?: ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ abstract class ConeAttribute<out T : ConeAttribute<T>> : AnnotationMarker {
|
||||
abstract fun isSubtypeOf(other: @UnsafeVariance T?): Boolean
|
||||
|
||||
abstract override fun toString(): String
|
||||
open fun renderForReadability(): String = toString()
|
||||
open fun renderForReadability(): String? = null
|
||||
|
||||
abstract val key: KClass<out T>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user