Fix wrong generated class name invoking inner objects from another module

This commit is contained in:
Natalia.Ukhorskaya
2013-08-05 16:20:25 +04:00
parent e3643fd222
commit 8e45bb7657
10 changed files with 77 additions and 5 deletions
@@ -362,16 +362,14 @@ public class CodegenBinding {
if (containingKlass.getKind() == ClassKind.ENUM_CLASS) {
return getJvmInternalName(bindingTrace, containingKlass).getInternalName();
}
else if (klass.getKind() == ClassKind.OBJECT) {
return getJvmInternalName(bindingTrace, containingKlass).getInternalName() + "$" + klass.getName();
}
else {
return getJvmInternalName(bindingTrace, containingKlass).getInternalName() + JvmAbi.CLASS_OBJECT_SUFFIX;
}
}
}
JvmClassName name = bindingTrace.getBindingContext().get(FQN, descriptor);
if (name != null) {
return name.getInternalName();
}
}
DeclarationDescriptor container = descriptor.getContainingDeclaration();
@@ -0,0 +1,7 @@
package aaa
class A {
class O {
val s = "OK"
}
}
@@ -0,0 +1,6 @@
fun main(args: Array<String>) {
val str = aaa.A.O().s
if (str != "OK") {
throw Exception()
}
}
@@ -0,0 +1,7 @@
package aaa
class A {
enum class E {
A
}
}
@@ -0,0 +1,6 @@
fun main(args: Array<String>) {
val str = aaa.A().E.A
if (str.toString() != "A") {
throw Exception()
}
}
@@ -0,0 +1,9 @@
package aaa
class A {
class B {
class O {
val s = "OK"
}
}
}
@@ -0,0 +1,6 @@
fun main(args: Array<String>) {
val str = aaa.A.B.O().s
if (str != "OK") {
throw Exception()
}
}
@@ -0,0 +1,7 @@
package aaa
class A {
object O {
val s = "OK"
}
}
@@ -0,0 +1,6 @@
fun main(args: Array<String>) {
val str = aaa.A().O.s
if (str != "OK") {
throw Exception()
}
}
@@ -56,6 +56,26 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
doTest("compiler/testData/compileKotlinAgainstKotlin/ImportObject.A.kt");
}
@TestMetadata("InnerClass.A.kt")
public void testInnerClass() throws Exception {
doTest("compiler/testData/compileKotlinAgainstKotlin/InnerClass.A.kt");
}
@TestMetadata("InnerEnum.A.kt")
public void testInnerEnum() throws Exception {
doTest("compiler/testData/compileKotlinAgainstKotlin/InnerEnum.A.kt");
}
@TestMetadata("InnerInnerClass.A.kt")
public void testInnerInnerClass() throws Exception {
doTest("compiler/testData/compileKotlinAgainstKotlin/InnerInnerClass.A.kt");
}
@TestMetadata("InnerObject.A.kt")
public void testInnerObject() throws Exception {
doTest("compiler/testData/compileKotlinAgainstKotlin/InnerObject.A.kt");
}
@TestMetadata("Simple.A.kt")
public void testSimple() throws Exception {
doTest("compiler/testData/compileKotlinAgainstKotlin/Simple.A.kt");