Get accessors for companion object properties through wrapper class

This commit is contained in:
Mikhail Zarechenskiy
2018-02-06 16:18:51 +03:00
parent 70cd1cfcdf
commit 47aeeb36e4
7 changed files with 53 additions and 5 deletions
@@ -1663,7 +1663,8 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor;
// `this` is represented as first parameter of function in erased inline class
if (contextKind() == OwnerKind.ERASED_INLINE_CLASS) {
if (contextKind() == OwnerKind.ERASED_INLINE_CLASS &&
InlineClassesUtilsKt.isInlineClass(propertyDescriptor.getContainingDeclaration())) {
Type underlyingRepresentationType = typeMapper.mapType(propertyDescriptor.getType());
return StackValue.local(0, underlyingRepresentationType);
}
@@ -810,13 +810,13 @@ public class KotlinTypeMapper {
}
}
else {
boolean isInsideInlineClass = currentOwner.isInline();
boolean toInlinedErasedClass = currentOwner.isInline() && !isAccessor(functionDescriptor);
boolean isStaticInvocation = (isStaticDeclaration(functionDescriptor) &&
!(functionDescriptor instanceof ImportedFromObjectCallableDescriptor)) ||
isStaticAccessor(functionDescriptor) ||
CodegenUtilKt.isJvmStaticInObjectOrClassOrInterface(functionDescriptor) ||
isInsideInlineClass;
toInlinedErasedClass;
if (isStaticInvocation) {
invokeOpcode = INVOKESTATIC;
isInterfaceMember = currentIsInterface && currentOwner instanceof JavaClassDescriptor;
@@ -838,7 +838,7 @@ public class KotlinTypeMapper {
? overriddenSpecialBuiltinFunction.getOriginal()
: functionDescriptor.getOriginal();
signature = isInsideInlineClass
signature = toInlinedErasedClass
? mapSignatureForInlineErasedClassSkipGeneric(functionToCall)
: mapSignatureSkipGeneric(functionToCall);
returnKotlinType = functionToCall.getReturnType();
@@ -846,7 +846,7 @@ public class KotlinTypeMapper {
ClassDescriptor receiver = (currentIsInterface && !originalIsInterface) || currentOwner instanceof FunctionClassDescriptor
? declarationOwner
: currentOwner;
owner = isInsideInlineClass ? mapErasedInlineClass(receiver) : mapClass(receiver);
owner = toInlinedErasedClass ? mapErasedInlineClass(receiver) : mapClass(receiver);
thisClass = owner;
dispatchReceiverKotlinType = receiver.getDefaultType();
}