Fix JVM signatures involving multi-dimensional array types

Apparently ASM's Type#getElementType returns the type of the array even if it's
multi-dimensional, so the loop was incorrect
This commit is contained in:
Alexander Udalov
2015-04-01 16:04:16 +03:00
parent 7e86d87133
commit 0202217135
10 changed files with 67 additions and 8 deletions
@@ -0,0 +1,16 @@
class A {
class B(val result: String)
var p: A.B? = null
var q: Array<Array<A.B>>? = null
}
fun box(): String {
val a = A()
(A::q).set(a, array(array(A.B("array"))))
if (a.q!![0][0].result != "array") return "Fail array"
(A::p).set(a, A.B("OK"))
return a.p!!.result
}
@@ -0,0 +1,12 @@
//ALLOW_AST_ACCESS
package test
annotation class Anno(val s: String)
trait T {
Anno("foo")
fun foo(): Array<Array<Array<T>>>
Anno("bar")
val bar: Array<Array<BooleanArray>>
}
@@ -0,0 +1,13 @@
package test
internal final annotation class Anno : kotlin.Annotation {
/*primary*/ public constructor Anno(/*0*/ s: kotlin.String)
internal final val s: kotlin.String
internal final fun <get-s>(): kotlin.String
}
internal trait T {
test.Anno(s = "bar": kotlin.String) internal abstract val bar: kotlin.Array<kotlin.Array<kotlin.BooleanArray>>
internal abstract fun <get-bar>(): kotlin.Array<kotlin.Array<kotlin.BooleanArray>>
test.Anno(s = "foo": kotlin.String) internal abstract fun foo(): kotlin.Array<kotlin.Array<kotlin.Array<test.T>>>
}