[K2] Use file name as one of parameters to extract evaluated const

It is not enough to store evaluated constants only by
<startOffset, endOffset> pair. We need to consider case there constant
can be located in different files with the same offset but with
different values.

#KT-57928 Fixed
#KT-57929 Fixed
This commit is contained in:
Ivan Kylchik
2023-04-11 12:56:59 +02:00
committed by Space Team
parent 8cc8e54a9f
commit c00c7ffbe0
13 changed files with 123 additions and 100 deletions
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.ir.interpreter.isPrimitiveArray
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.dump
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
import org.jetbrains.kotlin.name.Name
import kotlin.math.max
import kotlin.math.min
@@ -76,7 +77,7 @@ class IrConstTransformer(
}
evaluatedConstTracker?.save(
result.startOffset, result.endOffset,
result.startOffset, result.endOffset, irFile.fqName.child(Name.identifier(irFile.name)).asString(),
constant = if (result is IrErrorExpression) ErrorValue.create(result.description)
else (result as IrConst<*>).toConstantValue()
)