290adda8fc
This commit handles situations when some annotation in deserialized code has an empty array literal argument [] or even non-empty [something]. Before this commit, we tried to guess a type of this array by "resolving" the relevant annotation class and looking into the corresponding parameter. Sometimes it can work, but also it can provoke recursive resolve e.g. when the annotation class is a nested class in the same scope. In this commit we changed the behavior in the following way: - first, for non-empty array literals in deserialized code we just take the array type from the corresponding array literal element - second, for empty array literals we no more try to "guess" anything. Instead we approximate array type as Array<Any>, and later at FIR2IR stage we use the corresponding parameter type instead. At FIR2IR stage, everything is already resolved and problems with recursions are no more possible. #KT-62598 Fixed
34 lines
653 B
Kotlin
Vendored
34 lines
653 B
Kotlin
Vendored
// TARGET_BACKEND: JVM_IR
|
|
// FIR_IDENTICAL
|
|
// DUMP_IR
|
|
// WITH_STDLIB
|
|
// ISSUE: KT-62598
|
|
// This test is a simplified version of annotations/instances/multimoduleCreation.kt with potential deserialized annotation resolve problems
|
|
|
|
// MODULE: lib
|
|
// FILE: AnnotationInstantiationWithArrayLib.kt
|
|
|
|
package a
|
|
|
|
annotation class Outer(
|
|
val array: Array<Inner> = [Inner([1]), Inner([2]), Inner([])]
|
|
) {
|
|
annotation class Inner(val v: IntArray = [])
|
|
}
|
|
|
|
// MODULE: app(lib)
|
|
// FILE: AnnotationInstantiationWithArrayApp.kt
|
|
|
|
package test
|
|
|
|
import a.*
|
|
|
|
class C {
|
|
fun six(): Outer = Outer()
|
|
}
|
|
|
|
fun box(): String {
|
|
C().six().toString()
|
|
return "OK"
|
|
}
|