KT-2060 fix
This commit is contained in:
@@ -1229,10 +1229,12 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
||||
|
||||
boolean isStatic = containingDeclaration instanceof NamespaceDescriptor;
|
||||
boolean overridesTrait = isOverrideForTrait(propertyDescriptor);
|
||||
propertyDescriptor = propertyDescriptor.getOriginal();
|
||||
boolean isInsideClass = ((containingDeclaration == context.getThisDescriptor()) ||
|
||||
boolean isFakeOverride = propertyDescriptor.getKind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE;
|
||||
PropertyDescriptor initialDescriptor = propertyDescriptor;
|
||||
propertyDescriptor = initialDescriptor.getOriginal();
|
||||
boolean isInsideClass = !isFakeOverride && (((containingDeclaration == context.getThisDescriptor()) ||
|
||||
(context.getParentContext() instanceof CodegenContexts.NamespaceContext) && context.getParentContext().getContextDescriptor() == containingDeclaration)
|
||||
&& contextKind() != OwnerKind.TRAIT_IMPL;
|
||||
&& contextKind() != OwnerKind.TRAIT_IMPL);
|
||||
Method getter;
|
||||
Method setter;
|
||||
if (forceField) {
|
||||
@@ -1305,7 +1307,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
||||
// TODO ugly
|
||||
CallableMethod callableMethod = typeMapper.mapToCallableMethod(propertyDescriptor.getGetter(), isSuper, contextKind());
|
||||
invokeOpcode = callableMethod.getInvokeOpcode();
|
||||
owner = callableMethod.getOwner();
|
||||
owner = isFakeOverride && !overridesTrait && !CodegenUtil.isInterface(initialDescriptor.getContainingDeclaration()) ? JvmClassName.byType(typeMapper.mapType(((ClassDescriptor)initialDescriptor.getContainingDeclaration()).getDefaultType(), MapTypeMode.IMPL)): callableMethod.getOwner();
|
||||
ownerParam = callableMethod.getDefaultImplParam();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package testing; // There is no error if both files are in default package
|
||||
|
||||
public abstract class ClassWithInternals {
|
||||
protected var some: Int = 0;
|
||||
protected var someGetter: Int = 0
|
||||
get() = 5
|
||||
|
||||
protected fun foo() : Int = 0
|
||||
|
||||
public abstract fun start() : Unit;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import testing.ClassWithInternals
|
||||
|
||||
public class HelloServer() : ClassWithInternals() {
|
||||
public override fun start() {
|
||||
val test = foo() + someGetter //+ some
|
||||
}
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
HelloServer().start()
|
||||
return "OK"
|
||||
}
|
||||
@@ -466,4 +466,9 @@ public class ClassGenTest extends CodegenTestCase {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxFile("regressions/kt2391.kt");
|
||||
}
|
||||
|
||||
public void testKt2060() {
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
|
||||
blackBoxMultiFile("regressions/kt2060_1.kt", "regressions/kt2060.kt");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user