Add original KotlinType to rendered IrErrorType

Also improve an error message in `IrType.erasedUpperBound`, which seems
like a frequent first place where the JVM IR backend crashes in case an
error type has made it past psi2ir.

This will help in diagnosing problems such as KT-45016.
This commit is contained in:
Alexander Udalov
2021-03-01 20:28:27 +01:00
parent cd9463ae8d
commit e3dc112c5f
7 changed files with 60 additions and 59 deletions
@@ -53,8 +53,8 @@ FILE fqName:<root> fileName:/arrayAsVarargAfterSamArgument.kt
strs: VARARG type=kotlin.Array<out kotlin.String?>? varargElementType=kotlin.String?
SPREAD_ELEMENT
GET_VAR 'arr: kotlin.Array<kotlin.String> declared in <root>.test' type=kotlin.Array<kotlin.String> origin=null
VAR name:i1 type:IrErrorType [val]
ERROR_CALL 'Unresolved reference: <Ambiguity: Test, [/Test.Test, /Test.Test]>#' type=IrErrorType
VAR name:i1 type:IrErrorType(null) [val]
ERROR_CALL 'Unresolved reference: <Ambiguity: Test, [/Test.Test, /Test.Test]>#' type=IrErrorType(null)
FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
@@ -72,8 +72,8 @@ FILE fqName:<root> fileName:/arrayAsVarargAfterSamArgument.kt
strs: VARARG type=kotlin.Array<out kotlin.String?>? varargElementType=kotlin.String?
SPREAD_ELEMENT
GET_VAR 'arr: kotlin.Array<kotlin.String> declared in <root>.test' type=kotlin.Array<kotlin.String> origin=null
VAR name:i3 type:IrErrorType [val]
ERROR_CALL 'Unresolved reference: <Ambiguity: Test, [/Test.Test, /Test.Test]>#' type=IrErrorType
VAR name:i3 type:IrErrorType(null) [val]
ERROR_CALL 'Unresolved reference: <Ambiguity: Test, [/Test.Test, /Test.Test]>#' type=IrErrorType(null)
FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
@@ -125,7 +125,7 @@ FILE fqName:<root> fileName:/arrayAsVarargAfterSamArgument.kt
strs: VARARG type=kotlin.Array<out kotlin.String?>? varargElementType=kotlin.String?
SPREAD_ELEMENT
GET_VAR 'arr: kotlin.Array<kotlin.String> declared in <root>.test' type=kotlin.Array<kotlin.String> origin=null
ERROR_CALL 'Unresolved reference: <Unresolved name: foo2>#' type=IrErrorType
ERROR_CALL 'Unresolved reference: <Unresolved name: foo2>#' type=IrErrorType(null)
FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
@@ -137,7 +137,7 @@ FILE fqName:<root> fileName:/arrayAsVarargAfterSamArgument.kt
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.test'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
GET_VAR 'arr: kotlin.Array<kotlin.String> declared in <root>.test' type=kotlin.Array<kotlin.String> origin=null
ERROR_CALL 'Unresolved reference: <Unresolved name: foo2>#' type=IrErrorType
ERROR_CALL 'Unresolved reference: <Unresolved name: foo2>#' type=IrErrorType(null)
GET_VAR 'r: java.lang.Runnable declared in <root>.test' type=java.lang.Runnable origin=null
FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
@@ -145,7 +145,7 @@ FILE fqName:<root> fileName:/arrayAsVarargAfterSamArgument.kt
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.test'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
CONST String type=kotlin.String value=""
ERROR_CALL 'Unresolved reference: <Unresolved name: foo2>#' type=IrErrorType
ERROR_CALL 'Unresolved reference: <Unresolved name: foo2>#' type=IrErrorType(null)
FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
@@ -157,7 +157,7 @@ FILE fqName:<root> fileName:/arrayAsVarargAfterSamArgument.kt
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.test'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
GET_VAR 'arr: kotlin.Array<kotlin.String> declared in <root>.test' type=kotlin.Array<kotlin.String> origin=null
ERROR_CALL 'Unresolved reference: <Unresolved name: foo2>#' type=IrErrorType
ERROR_CALL 'Unresolved reference: <Unresolved name: foo2>#' type=IrErrorType(null)
GET_VAR 'r: java.lang.Runnable declared in <root>.test' type=java.lang.Runnable origin=null
FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit