[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
@@ -26,3 +26,15 @@ fun test7() {}
@Foo(<!NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION!>[<!NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION!>two<!>]<!>, [], [])
fun test8() {}
interface I<T>
class C<T> : I<T>
annotation class Test1<T>(val x: Int)
annotation class Test2<T1, T2 : I<T1>>(val x: Test1<I<T2>>)
@Repeatable annotation class Test3(val x: Array<Test2<Int, C<Int>>>)
@Test3(<!TYPE_MISMATCH!>[Test2<String, C<String>>(Test1(40))]<!>)
@Test3([Test2<Int, C<Int>>(Test1(40))])
@Test3([Test2(Test1(40))])
fun test9() {}