Use type from compile time value for binary expression

This commit is contained in:
Natalia Ukhorskaya
2013-12-04 18:10:37 +04:00
parent 6331dd2308
commit 53a5264aaf
42 changed files with 685 additions and 42 deletions
@@ -3,30 +3,30 @@ import java.lang.annotation.RetentionPolicy
Retention(RetentionPolicy.RUNTIME)
annotation class Ann(
val b1: Byte,
val b2: Short,
val b3: Int,
val b4: Long,
val b5: Double,
val b6: Float
val p1: Byte,
val p2: Short,
val p3: Int,
val p4: Long,
val p5: Double,
val p6: Float
)
val b1: Byte = -1
val b2: Short = -1
val b3: Int = -1
val b4: Long = -1
val b5: Double = -1.0
val b6: Float = -1.0.toFloat()
val prop1: Byte = -1
val prop2: Short = -1
val prop3: Int = -1
val prop4: Long = -1
val prop5: Double = -1.0
val prop6: Float = -1.0.toFloat()
Ann(b1, b2, b3, b4, b5, b6) class MyClass
Ann(prop1, prop2, prop3, prop4, prop5, prop6) class MyClass
fun box(): String {
val annotation = javaClass<MyClass>().getAnnotation(javaClass<Ann>())!!
if (annotation.b1 != b1) return "fail 1"
if (annotation.b2 != b2) return "fail 2"
if (annotation.b3 != b3) return "fail 3"
if (annotation.b4 != b4) return "fail 4"
if (annotation.b5 != b5) return "fail 5"
if (annotation.b6 != b6) return "fail 6"
if (annotation.p1 != prop1) return "fail 1, expected = ${prop1}, actual = ${annotation.p1}"
if (annotation.p2 != prop2) return "fail 2, expected = ${prop2}, actual = ${annotation.p2}"
if (annotation.p3 != prop3) return "fail 3, expected = ${prop3}, actual = ${annotation.p3}"
if (annotation.p4 != prop4) return "fail 4, expected = ${prop4}, actual = ${annotation.p4}"
if (annotation.p5 != prop5) return "fail 5, expected = ${prop5}, actual = ${annotation.p5}"
if (annotation.p6 != prop6) return "fail 6, expected = ${prop6}, actual = ${annotation.p6}"
return "OK"
}