Do not use receiver type as GET_OBJECT type when interpreting constants
It is incompatible with type erasure of non-reified type parameters on inlining (which will be done in future). See NaNPropagationTest.kt for example.
This commit is contained in:
committed by
Space Team
parent
44caa3cdd5
commit
286196e8b2
+4
-2
@@ -17,7 +17,8 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrGetObjectValueImpl
|
|||||||
import org.jetbrains.kotlin.ir.interpreter.correspondingProperty
|
import org.jetbrains.kotlin.ir.interpreter.correspondingProperty
|
||||||
import org.jetbrains.kotlin.ir.interpreter.isConst
|
import org.jetbrains.kotlin.ir.interpreter.isConst
|
||||||
import org.jetbrains.kotlin.ir.interpreter.property
|
import org.jetbrains.kotlin.ir.interpreter.property
|
||||||
import org.jetbrains.kotlin.ir.types.classOrFail
|
import org.jetbrains.kotlin.ir.util.defaultType
|
||||||
|
import org.jetbrains.kotlin.ir.util.parentAsClass
|
||||||
|
|
||||||
class IrInterpreterConstGetterPreprocessor : IrInterpreterPreprocessor {
|
class IrInterpreterConstGetterPreprocessor : IrInterpreterPreprocessor {
|
||||||
override fun visitFunction(declaration: IrFunction, data: IrInterpreterPreprocessorData): IrStatement {
|
override fun visitFunction(declaration: IrFunction, data: IrInterpreterPreprocessorData): IrStatement {
|
||||||
@@ -46,7 +47,8 @@ class IrInterpreterConstGetterPreprocessor : IrInterpreterPreprocessor {
|
|||||||
|
|
||||||
transformChildren(this@IrInterpreterConstGetterPreprocessor, data)
|
transformChildren(this@IrInterpreterConstGetterPreprocessor, data)
|
||||||
|
|
||||||
val getObject = IrGetObjectValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, receiver.type, receiver.type.classOrFail)
|
val fieldParent = field.parentAsClass
|
||||||
|
val getObject = IrGetObjectValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, fieldParent.defaultType, fieldParent.symbol)
|
||||||
when (this) {
|
when (this) {
|
||||||
is IrCall -> this.dispatchReceiver = getObject
|
is IrCall -> this.dispatchReceiver = getObject
|
||||||
is IrGetField -> this.receiver = getObject
|
is IrGetField -> this.receiver = getObject
|
||||||
|
|||||||
Reference in New Issue
Block a user