Support toInt, toChar and etc as CompileTimeConstants

This commit is contained in:
Natalia Ukhorskaya
2013-11-06 12:27:56 +04:00
parent f218bd1df2
commit 0b1dd2d2be
14 changed files with 297 additions and 76 deletions
@@ -0,0 +1,12 @@
package test
annotation class Ann(
val b1: Byte,
val b2: Byte,
val b3: Byte,
val b4: Byte
)
Ann(1, 1.toByte(), 128.toByte(), 128) class MyClass
// EXPECTED: Ann[b1 = 1.toByte(): jet.Byte, b2 = 1.toByte(): jet.Byte, b3 = -128.toByte(): jet.Byte, b4 = 128.toInt(): jet.Int]
@@ -0,0 +1,16 @@
package test
annotation class Ann(
val b1: Char,
val b2: Char,
val b3: Int,
val b4: Long,
val b5: Byte,
val b6: Short,
val b7: Double,
val b8: Float
)
Ann('c', 99.toChar(), 'c'.toInt(), 'c'.toLong(), 'c'.toByte(), 'c'.toShort(), 'c'.toDouble(), 'c'.toFloat()) class MyClass
// EXPECTED: Ann[b1 = #99(c): jet.Char, b2 = #99(c): jet.Char, b3 = 99.toInt(): jet.Int, b4 = 99.toLong(): jet.Long, b5 = 99.toByte(): jet.Byte, b6 = 99.toShort(): jet.Short, b7 = 99.0.toDouble(): jet.Double, b8 = 99.0.toFloat(): jet.Float]
@@ -0,0 +1,12 @@
package test
annotation class Ann(
val b1: Double,
val b2: Double,
val b3: Double,
val b4: Double
)
Ann(1.0, 1.toDouble(), 1.7976931348623157E309.toDouble(), 1.7976931348623157E309) class MyClass
// EXPECTED: Ann[b1 = 1.0.toDouble(): jet.Double, b2 = 1.0.toDouble(): jet.Double, b3 = Infinity.toDouble(): jet.Double, b4 = Infinity.toDouble(): jet.Double]
@@ -0,0 +1,12 @@
package test
annotation class Ann(
val b1: Float,
val b2: Float,
val b3: Float,
val b4: Float
)
Ann(1.0, 1.toFloat(), 1.0.toFloat()) class MyClass
// EXPECTED: Ann[b1 = 1.0.toFloat(): jet.Float, b2 = 1.0.toFloat(): jet.Float, b3 = 1.0.toFloat(): jet.Float]
@@ -0,0 +1,12 @@
package test
annotation class Ann(
val b1: Int,
val b2: Int,
val b3: Int,
val b4: Int
)
Ann(1, 1.toInt(), 2147483648.toInt(), 2147483648) class MyClass
// EXPECTED: Ann[b1 = 1.toInt(): jet.Int, b2 = 1.toInt(): jet.Int, b3 = -2147483648.toInt(): jet.Int, b4 = 2147483648.toLong(): jet.Long]
@@ -0,0 +1,10 @@
package test
annotation class Ann(
val b1: Long,
val b2: Long
)
Ann(1, 1.toLong()) class MyClass
// EXPECTED: Ann[b1 = 1.toLong(): jet.Long, b2 = 1.toLong(): jet.Long]
@@ -0,0 +1,12 @@
package test
annotation class Ann(
val b1: Short,
val b2: Short,
val b3: Short,
val b4: Short
)
Ann(1, 1.toShort(), 32768.toShort(), 32768) class MyClass
// EXPECTED: Ann[b1 = 1.toShort(): jet.Short, b2 = 1.toShort(): jet.Short, b3 = -32768.toShort(): jet.Short, b4 = 32768.toInt(): jet.Int]