Calculate empty array literal types in FIR2IR instead of deserializer

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
This commit is contained in:
Mikhail Glukhikh
2023-10-17 17:20:57 +02:00
committed by Space Team
parent 19a95f2fb4
commit 290adda8fc
16 changed files with 249 additions and 42 deletions
@@ -52,7 +52,6 @@ interface HolderWithEmpty {
import Holder
import ByteHolder
import HolderWithDefault
// This line still provokes SOE in K2
//import HolderWithEmpty
import HolderWithEmpty
fun box() = "OK"