[FIR] Resolve array literal argument for non-primitive-array parameter as arrayOf call in annotation calls

This allows us to properly complete array literals arguments of
annotation calls fixing several false-negative type mismatch errors
as well as enabling the inference of generic type arguments.

#KT-59581 Fixed
#KT-58883 Fixed
This commit is contained in:
Kirill Rakhman
2023-07-18 12:01:05 +02:00
committed by Space Team
parent e69b695efd
commit 97024d9ccb
14 changed files with 145 additions and 34 deletions
@@ -222,7 +222,7 @@ FILE fqName:ann fileName:/genericAnnotationClasses.kt
Test1<ann.ARG>(x = '42')
Test2<kotlin.String, kotlin.String>(x = '38')
Test3<kotlin.String, ann.C<kotlin.String>>(x = Test1<ann.I<ann.C<kotlin.String>>>(x = '39'))
Test4(x = [Test3<IrErrorType(null), IrErrorType(null)>(x = Test1<IrErrorType(null)>(x = '40')), Test3<IrErrorType(null), IrErrorType(null)>(x = Test1<IrErrorType(null)>(x = '50')), Test3<IrErrorType(null), IrErrorType(null)>(x = Test1<IrErrorType(null)>(x = '60'))])
Test4(x = [Test3<kotlin.Int, ann.C<kotlin.Int>>(x = Test1<ann.I<ann.C<kotlin.Int>>>(x = '40')), Test3<kotlin.Int, ann.C<kotlin.Int>>(x = Test1<ann.I<ann.C<kotlin.Int>>>(x = '50')), Test3<kotlin.Int, ann.C<kotlin.Int>>(x = Test1<ann.I<ann.C<kotlin.Int>>>(x = '60'))])
Test5<ann.ARG>(xs = [Test3<ann.ARG, ann.C<ann.ARG>>(x = Test1<ann.I<ann.C<ann.ARG>>>(x = '70')), Test3<ann.ARG, ann.C<ann.ARG>>(x = Test1<ann.I<ann.C<ann.ARG>>>(x = '80'))])
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:ann.CC
CONSTRUCTOR visibility:public <> () returnType:ann.CC [primary]
@@ -90,7 +90,7 @@ open annotation class Test5<T : Any?> : Annotation {
@Test1<ARG>(x = 42)
@Test2<String, String>(x = 38)
@Test3<String, C<String>>(x = Test1<I<C<String>>>(x = 39))
@Test4(x = [Test3<ErrorType, ErrorType>(x = Test1<ErrorType>(x = 40)), Test3<ErrorType, ErrorType>(x = Test1<ErrorType>(x = 50)), Test3<ErrorType, ErrorType>(x = Test1<ErrorType>(x = 60))])
@Test4(x = [Test3<Int, C<Int>>(x = Test1<I<C<Int>>>(x = 40)), Test3<Int, C<Int>>(x = Test1<I<C<Int>>>(x = 50)), Test3<Int, C<Int>>(x = Test1<I<C<Int>>>(x = 60))])
@Test5<ARG>(xs = [Test3<ARG, C<ARG>>(x = Test1<I<C<ARG>>>(x = 70)), Test3<ARG, C<ARG>>(x = Test1<I<C<ARG>>>(x = 80))])
class CC {
constructor() /* primary */ {
@@ -1,5 +1,5 @@
// MUTE_SIGNATURE_COMPARISON_K2: ANY
// ^ KT-54517
// ^ KT-60136
package ann