Skip to content

Commit

Permalink
Fix JVM signature mapping for multi-dimensional arrays
Browse files Browse the repository at this point in the history
 #KT-11314 Fixed
  • Loading branch information
dzharkov committed Feb 17, 2017
1 parent 83d64e8 commit 0d8f643
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 1 deletion.
Expand Up @@ -18,6 +18,7 @@

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.AsmUtil;
import org.jetbrains.kotlin.load.kotlin.JvmDescriptorTypeWriter;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodGenericSignature;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
Expand Down Expand Up @@ -57,7 +58,7 @@ public void writeAsmType(@NotNull Type asmType) {
return;
case Type.ARRAY:
writeArrayType();
writeAsmType(asmType.getElementType());
writeAsmType(AsmUtil.correctElementType(asmType));
writeArrayEnd();
return;
default:
Expand Down
@@ -0,0 +1,14 @@
// WITH_RUNTIME
abstract class Table<T>(
val content: Array<Array<T>>
)

fun box(): String {
val x = object : Table<String>(
Array(1, {
x-> Array(1, {y -> "OK"})
})
) {}

return x.content[0][0]
}
@@ -0,0 +1,11 @@
@kotlin.Metadata
public final class GenericArrayInObjectLiteralConstructorKt {
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}

@kotlin.Metadata
public abstract class Table {
private final @org.jetbrains.annotations.NotNull field content: java.lang.Object[][]
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.Object[][]): void
public final @org.jetbrains.annotations.NotNull method getContent(): java.lang.Object[][]
}
Expand Up @@ -377,6 +377,12 @@ public void testForEachShortArray() throws Exception {
doTest(fileName);
}

@TestMetadata("genericArrayInObjectLiteralConstructor.kt")
public void testGenericArrayInObjectLiteralConstructor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/genericArrayInObjectLiteralConstructor.kt");
doTest(fileName);
}

@TestMetadata("hashMap.kt")
public void testHashMap() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/hashMap.kt");
Expand Down
Expand Up @@ -377,6 +377,12 @@ public void testForEachShortArray() throws Exception {
doTest(fileName);
}

@TestMetadata("genericArrayInObjectLiteralConstructor.kt")
public void testGenericArrayInObjectLiteralConstructor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/genericArrayInObjectLiteralConstructor.kt");
doTest(fileName);
}

@TestMetadata("hashMap.kt")
public void testHashMap() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/hashMap.kt");
Expand Down
Expand Up @@ -527,6 +527,12 @@ public void testForEachShortArray() throws Exception {
doTest(fileName);
}

@TestMetadata("genericArrayInObjectLiteralConstructor.kt")
public void testGenericArrayInObjectLiteralConstructor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/genericArrayInObjectLiteralConstructor.kt");
doTest(fileName);
}

@TestMetadata("hashMap.kt")
public void testHashMap() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/arrays/hashMap.kt");
Expand Down

0 comments on commit 0d8f643

Please sign in to comment.