Fix codegen of loaded class objects
Remove useless check and todo. #KT-2717 Fixed #KT-3142 Fixed
This commit is contained in:
@@ -1449,16 +1449,9 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
}
|
||||
|
||||
if (descriptor instanceof ClassDescriptor) {
|
||||
PsiElement declaration = descriptorToDeclaration(bindingContext, descriptor);
|
||||
if (declaration instanceof JetClass) {
|
||||
final ClassDescriptor classObjectDescriptor = ((ClassDescriptor) descriptor).getClassObjectDescriptor();
|
||||
assert classObjectDescriptor != null;
|
||||
return StackValue.singleton(classObjectDescriptor, typeMapper);
|
||||
}
|
||||
else {
|
||||
// todo ?
|
||||
return StackValue.none();
|
||||
}
|
||||
ClassDescriptor classObjectDescriptor = ((ClassDescriptor) descriptor).getClassObjectDescriptor();
|
||||
assert classObjectDescriptor != null : "Class object is not found for " + descriptor;
|
||||
return StackValue.singleton(classObjectDescriptor, typeMapper);
|
||||
}
|
||||
|
||||
if (descriptor instanceof TypeParameterDescriptor) {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
class object {
|
||||
fun foo() = 42
|
||||
val bar = "OK"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
fun main(args: Array<String>) {
|
||||
if (A.foo() != 42) throw Exception()
|
||||
if (A.bar != "OK") throw Exception()
|
||||
}
|
||||
+5
@@ -33,6 +33,11 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/compileKotlinAgainstKotlin"), "A.kt", true);
|
||||
}
|
||||
|
||||
@TestMetadata("ClassObjectMember.A.kt")
|
||||
public void testClassObjectMember_A() throws Exception {
|
||||
doTest("compiler/testData/compileKotlinAgainstKotlin/ClassObjectMember.A.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("DefaultConstructor.A.kt")
|
||||
public void testDefaultConstructor_A() throws Exception {
|
||||
doTest("compiler/testData/compileKotlinAgainstKotlin/DefaultConstructor.A.kt");
|
||||
|
||||
Reference in New Issue
Block a user