[FIR] Display actual type for argument type mismatch error

Previously the argument type was being used for the actual type error
display. However, safe-call arguments are unwrapped which causes
nullable types to be displayed as non-null. Change to use the actual
type provided by the diagnostic instead of extracting the type from
the argument.

#KT-58844 Fixed
This commit is contained in:
Brian Norman
2023-06-15 08:25:22 -05:00
committed by Space Team
parent a7ff0cfc9d
commit 269dfc61c8
10 changed files with 57 additions and 3 deletions
@@ -12,7 +12,7 @@ annotation class Ann
fun <@Ann R : @Ann Any> f3(a: Array<@Ann R>): Array<@Ann R?> = null!!
fun test2(a: @Ann Array<in @Ann Int>) {
val r: Array<in Int?> = f3(<!ARGUMENT_TYPE_MISMATCH("kotlin/Array<@R|Ann|() R>; @R|Ann|() kotlin/Array<in @R|Ann|() kotlin/Int>")!>a<!>)
val r: Array<in Int?> = f3(<!ARGUMENT_TYPE_MISMATCH("kotlin/Array<@R|Ann|() R>; @R|Ann|() kotlin/Array<CapturedType(in @R|Ann|() kotlin/Int)>")!>a<!>)
}