arrow.meta.phases.analysis.diagnostic.Renderers.kt Maven / Gradle / Ivy
package arrow.meta.phases.analysis.diagnostic
import arrow.meta.plugins.proofs.phases.Proof
import arrow.meta.plugins.proofs.phases.asString
import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticParameterRenderer
import org.jetbrains.kotlin.diagnostics.rendering.RenderingContext
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.types.KotlinType
@JvmField
val RenderProof: DiagnosticParameterRenderer =
object : DiagnosticParameterRenderer {
override fun render(obj: Proof, renderingContext: RenderingContext): String = obj.asString()
}
@JvmField
val RenderProofs: DiagnosticParameterRenderer> =
object : DiagnosticParameterRenderer> {
override fun render(obj: Collection, renderingContext: RenderingContext): String =
obj.joinToString(separator = ",\n") { it.asString() }
}
val ProofRenderer: DescriptorRenderer = DescriptorRenderer.FQ_NAMES_IN_TYPES
@JvmField
val RenderTypes: DiagnosticParameterRenderer =
object : DiagnosticParameterRenderer {
override fun render(obj: KotlinType, renderingContext: RenderingContext): String =
ProofRenderer.renderType(obj)
}