Determine underlying property of inline class by its name
Previous way to distinguish "primary constructor properties" from other properties wasn't correct for deserialized properties, because currently we don't have special information about this in metadata
This commit is contained in:
@@ -1707,11 +1707,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
if (descriptor instanceof PropertyDescriptor) {
|
||||
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor;
|
||||
|
||||
boolean isUnderlyingPropertyOfInlineClass =
|
||||
InlineClassesUtilsKt.isInlineClass(propertyDescriptor.getContainingDeclaration()) &&
|
||||
JvmCodegenUtil.hasBackingField(propertyDescriptor, contextKind(), bindingContext);
|
||||
|
||||
if (isUnderlyingPropertyOfInlineClass) {
|
||||
if (InlineClassesUtilsKt.isUnderlyingPropertyOfInlineClass(propertyDescriptor)) {
|
||||
KotlinType propertyType = propertyDescriptor.getType();
|
||||
return StackValue.underlyingValueOfInlineClass(typeMapper.mapType(propertyType), propertyType, receiver);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.codegen.coroutines.SuspendFunctionGenerationStrategy
|
||||
import org.jetbrains.kotlin.codegen.coroutines.SuspendInlineFunctionGenerationStrategy;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
|
||||
import org.jetbrains.kotlin.codegen.state.TypeMapperUtilsKt;
|
||||
import org.jetbrains.kotlin.config.JvmDefaultMode;
|
||||
import org.jetbrains.kotlin.config.JvmTarget;
|
||||
import org.jetbrains.kotlin.config.LanguageFeature;
|
||||
@@ -295,8 +294,7 @@ public class FunctionCodegen {
|
||||
// descriptor corresponds to the underlying value
|
||||
if (functionDescriptor instanceof PropertyAccessorDescriptor) {
|
||||
PropertyDescriptor property = ((PropertyAccessorDescriptor) functionDescriptor).getCorrespondingProperty();
|
||||
// property for the underlying value
|
||||
if (JvmCodegenUtil.hasBackingField(property, contextKind, bindingContext)) {
|
||||
if (InlineClassesUtilsKt.isUnderlyingPropertyOfInlineClass(property)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user