methods on objects should always be called via invokevirtual() and not invokeinterface()

This commit is contained in:
Dmitry Jemerov
2011-07-15 16:31:00 +02:00
parent 9bfa61bfb2
commit 3592aff812
3 changed files with 10 additions and 1 deletions
@@ -165,7 +165,7 @@ public class JetTypeMapper {
public boolean isInterface(ClassDescriptor jetClass, OwnerKind kind) {
PsiElement declaration = bindingContext.getDeclarationPsiElement(jetClass);
if (declaration instanceof JetObjectDeclaration && ((JetObjectDeclaration) declaration).isObjectLiteral()) {
if (declaration instanceof JetObjectDeclaration) {
return false;
}
return kind == OwnerKind.INTERFACE;
@@ -0,0 +1,5 @@
object A {
fun result() = "OK"
}
fun box(): String = A.result()
@@ -11,4 +11,8 @@ public class ObjectGenTest extends CodegenTestCase {
public void testObjectLiteral() throws Exception {
blackBoxFile("objects/objectLiteral.jet");
}
public void testMethodOnObject() throws Exception {
blackBoxFile("objects/methodOnObject.jet");
}
}