From a5157aa239b0d7ba46bc69e25c596d5f4409319b Mon Sep 17 00:00:00 2001 From: Mads Ager Date: Wed, 10 May 2023 11:48:48 +0200 Subject: [PATCH] [FIR] Render attributes on function types. Only render if there are non-compiler attributes to reduce noise from extension function types. --- .../jetbrains/kotlin/fir/renderer/ConeTypeRenderer.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/renderer/ConeTypeRenderer.kt b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/renderer/ConeTypeRenderer.kt index bf85c13e520..44172fa1e0e 100644 --- a/compiler/fir/cones/src/org/jetbrains/kotlin/fir/renderer/ConeTypeRenderer.kt +++ b/compiler/fir/cones/src/org/jetbrains/kotlin/fir/renderer/ConeTypeRenderer.kt @@ -25,6 +25,8 @@ open class ConeTypeRenderer { return } + type.renderNonCompilerAttributes() + if (type.isMarkedNullable) { builder.append("(") } @@ -180,6 +182,13 @@ open class ConeTypeRenderer { builder.append(attributeRenderer.render(attributes)) } + private fun ConeKotlinType.renderNonCompilerAttributes() { + val compilerAttributes = CompilerConeAttributes.classIdByCompilerAttributeKey + if (attributes.any { it.key !in compilerAttributes }) { + builder.append(attributeRenderer.render(attributes)) + } + } + private fun ConeTypeProjection.render() { when (this) { ConeStarProjection -> {