JVM IR: Make receiver type of IrGetField not null
otherwise, it will be mapped to inline class type if underlying type is primitive of nullable. #KT-52913 Fixed
This commit is contained in:
+5
-2
@@ -388,9 +388,12 @@ private class JvmInlineClassLowering(context: JvmBackendContext) : JvmValueClass
|
||||
if (field.origin == IrDeclarationOrigin.PROPERTY_BACKING_FIELD &&
|
||||
parent is IrClass &&
|
||||
parent.isSingleFieldValueClass &&
|
||||
field.name == parent.inlineClassFieldName) {
|
||||
field.name == parent.inlineClassFieldName
|
||||
) {
|
||||
val receiver = expression.receiver!!.transform(this, null)
|
||||
return coerceInlineClasses(receiver, receiver.type, field.type)
|
||||
// If we get the field of nullable variable, we can be sure, that type is not null,
|
||||
// since we first generate null check.
|
||||
return coerceInlineClasses(receiver, receiver.type.makeNotNull(), field.type)
|
||||
}
|
||||
return super.visitGetField(expression)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user