Support primitive array annotation arguments in ConstantValueFactory

This has no visible consequences at the moment, but will help once we
need to load such argument from some annotation in the compiler in the
future
This commit is contained in:
Alexander Udalov
2017-06-22 18:55:55 +03:00
parent b67542533b
commit e42b151561
8 changed files with 91 additions and 6 deletions
@@ -0,0 +1,24 @@
package test
annotation class Anno(
val bytes: ByteArray,
val shorts: ShortArray,
val ints: IntArray,
val longs: LongArray,
val chars: CharArray,
val floats: FloatArray,
val doubles: DoubleArray,
val booleans: BooleanArray
)
@Anno(
byteArrayOf(42.toByte(), (-1).toByte()),
shortArrayOf((-42).toShort(), 0.toShort()),
intArrayOf(42, 239),
longArrayOf(42L, 239L),
charArrayOf('a', 'Z'),
floatArrayOf(2.72f, 0.0f),
doubleArrayOf(42.0, -3.14),
booleanArrayOf(true, false)
)
class Klass
@@ -0,0 +1,25 @@
package test
public final annotation class Anno : kotlin.Annotation {
/*primary*/ public constructor Anno(/*0*/ bytes: kotlin.ByteArray, /*1*/ shorts: kotlin.ShortArray, /*2*/ ints: kotlin.IntArray, /*3*/ longs: kotlin.LongArray, /*4*/ chars: kotlin.CharArray, /*5*/ floats: kotlin.FloatArray, /*6*/ doubles: kotlin.DoubleArray, /*7*/ booleans: kotlin.BooleanArray)
public final val booleans: kotlin.BooleanArray
public final fun <get-booleans>(): kotlin.BooleanArray
public final val bytes: kotlin.ByteArray
public final fun <get-bytes>(): kotlin.ByteArray
public final val chars: kotlin.CharArray
public final fun <get-chars>(): kotlin.CharArray
public final val doubles: kotlin.DoubleArray
public final fun <get-doubles>(): kotlin.DoubleArray
public final val floats: kotlin.FloatArray
public final fun <get-floats>(): kotlin.FloatArray
public final val ints: kotlin.IntArray
public final fun <get-ints>(): kotlin.IntArray
public final val longs: kotlin.LongArray
public final fun <get-longs>(): kotlin.LongArray
public final val shorts: kotlin.ShortArray
public final fun <get-shorts>(): kotlin.ShortArray
}
@test.Anno(booleans = {true, false}, bytes = {42.toByte(), -1.toByte()}, chars = {\u0061 ('a'), \u005A ('Z')}, doubles = {42.0.toDouble(), -3.14.toDouble()}, floats = {2.72.toFloat(), 0.0.toFloat()}, ints = {42, 239}, longs = {42.toLong(), 239.toLong()}, shorts = {-42.toShort(), 0.toShort()}) public final class Klass {
/*primary*/ public constructor Klass()
}