Make NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION error
This commit is contained in:
@@ -7,11 +7,11 @@ annotation class Ann(
|
||||
val p5: Int
|
||||
)
|
||||
|
||||
val prop1: Int = 1.plus(1)
|
||||
val prop2: Int = 1.minus(1)
|
||||
val prop3: Int = 1.times(1)
|
||||
val prop4: Int = 1.div(1)
|
||||
val prop5: Int = 1.mod(1)
|
||||
const val prop1: Int = 1.plus(1)
|
||||
const val prop2: Int = 1.minus(1)
|
||||
const val prop3: Int = 1.times(1)
|
||||
const val prop4: Int = 1.div(1)
|
||||
const val prop5: Int = 1.mod(1)
|
||||
|
||||
@Ann(prop1, prop2, prop3, prop4, prop5) class MyClass
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@ annotation class Ann(
|
||||
val p6: Float
|
||||
)
|
||||
|
||||
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()
|
||||
const val prop1: Byte = -1
|
||||
const val prop2: Short = -1
|
||||
const val prop3: Int = -1
|
||||
const val prop4: Long = -1
|
||||
const val prop5: Double = -1.0
|
||||
const val prop6: Float = -1.0.toFloat()
|
||||
|
||||
@Ann(prop1, prop2, prop3, prop4, prop5, prop6) class MyClass
|
||||
|
||||
@@ -26,4 +26,4 @@ fun box(): String {
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@ annotation class Ann(
|
||||
val p6: Float
|
||||
)
|
||||
|
||||
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()
|
||||
const val prop1: Byte = +1
|
||||
const val prop2: Short = +1
|
||||
const val prop3: Int = +1
|
||||
const val prop4: Long = +1
|
||||
const val prop5: Double = +1.0
|
||||
const val prop6: Float = +1.0.toFloat()
|
||||
|
||||
@Ann(prop1, prop2, prop3, prop4, prop5, prop6) class MyClass
|
||||
|
||||
@@ -26,4 +26,4 @@ fun box(): String {
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user