Fix for KT-5150: Accessors for private methods are not generated for get/set conventions

#KT-5150 Fixed
This commit is contained in:
Michael Bogdanov
2015-11-05 12:34:21 +03:00
parent 0fcaaa80df
commit bd2b01ac1c
4 changed files with 41 additions and 7 deletions
@@ -2357,7 +2357,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
}
@NotNull
private FunctionDescriptor accessibleFunctionDescriptor(@NotNull ResolvedCall<?> resolvedCall) {
protected FunctionDescriptor accessibleFunctionDescriptor(@NotNull ResolvedCall<?> resolvedCall) {
FunctionDescriptor descriptor = (FunctionDescriptor) resolvedCall.getResultingDescriptor();
FunctionDescriptor originalIfSamAdapter = SamCodegenUtil.getOriginalIfSamAdapter(descriptor);
if (originalIfSamAdapter != null) {
@@ -911,8 +911,6 @@ public abstract class StackValue {
private final ExpressionCodegen codegen;
private final ResolvedCall<FunctionDescriptor> resolvedGetCall;
private final ResolvedCall<FunctionDescriptor> resolvedSetCall;
private final FunctionDescriptor setterDescriptor;
private final FunctionDescriptor getterDescriptor;
public CollectionElement(
@NotNull CollectionElementReceiver collectionElementReceiver,
@@ -924,10 +922,10 @@ public abstract class StackValue {
super(type, false, false, collectionElementReceiver, true);
this.resolvedGetCall = resolvedGetCall;
this.resolvedSetCall = resolvedSetCall;
this.setterDescriptor = resolvedSetCall == null ? null : resolvedSetCall.getResultingDescriptor();
this.getterDescriptor = resolvedGetCall == null ? null : resolvedGetCall.getResultingDescriptor();
this.setter = resolvedSetCall == null ? null : codegen.resolveToCallable(setterDescriptor, false, resolvedSetCall);
this.getter = resolvedGetCall == null ? null : codegen.resolveToCallable(getterDescriptor, false, resolvedGetCall);
this.setter = resolvedSetCall == null ? null :
codegen.resolveToCallable(codegen.accessibleFunctionDescriptor(resolvedSetCall), false, resolvedSetCall);
this.getter = resolvedGetCall == null ? null :
codegen.resolveToCallable(codegen.accessibleFunctionDescriptor(resolvedGetCall), false, resolvedGetCall);
this.codegen = codegen;
}