IR: do not try to render IrUninitializedType
This will improve exception messages in case some error happens on a function whose return type is uninitialized, as in KT-41401.
This commit is contained in:
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
|||||||
import org.jetbrains.kotlin.ir.symbols.IrTypeAliasSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrTypeAliasSymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.*
|
import org.jetbrains.kotlin.ir.types.*
|
||||||
|
import org.jetbrains.kotlin.ir.types.impl.IrUninitializedType
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||||
import org.jetbrains.kotlin.types.Variance
|
import org.jetbrains.kotlin.types.Variance
|
||||||
@@ -106,8 +107,9 @@ class RenderIrElementVisitor(private val normalizeNames: Boolean = false) : IrEl
|
|||||||
private inline fun <T> T.runTrimEnd(fn: T.() -> String): String =
|
private inline fun <T> T.runTrimEnd(fn: T.() -> String): String =
|
||||||
run(fn).trimEnd()
|
run(fn).trimEnd()
|
||||||
|
|
||||||
private fun IrType.render() =
|
private fun IrType.render(): String =
|
||||||
"${renderTypeAnnotations(annotations)}${renderTypeInner()}"
|
if (this === IrUninitializedType) "<Uninitialized>"
|
||||||
|
else "${renderTypeAnnotations(annotations)}${renderTypeInner()}"
|
||||||
|
|
||||||
private fun IrType.renderTypeInner() =
|
private fun IrType.renderTypeInner() =
|
||||||
when (this) {
|
when (this) {
|
||||||
|
|||||||
Reference in New Issue
Block a user