Add constructor parameter for compileTimeConstant (can be used in annotation)

This commit is contained in:
Natalia Ukhorskaya
2014-01-23 15:40:11 +04:00
parent fd3f852a93
commit 3f429116e5
37 changed files with 276 additions and 175 deletions
@@ -0,0 +1,28 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
annotation class Ann(vararg val i: String)
val topLevel = "topLevel"
fun foo() {
val a1 = "a"
val a2 = "b"
val a3 = a1 + a2
val a4 = 1
val a5 = 1.0
[Ann(
<!ANNOTATION_PARAMETER_MUST_BE_CONST!>a1<!>,
<!ANNOTATION_PARAMETER_MUST_BE_CONST!>a2<!>,
<!ANNOTATION_PARAMETER_MUST_BE_CONST!>a3<!>,
"$topLevel",
<!ANNOTATION_PARAMETER_MUST_BE_CONST!>"$a1"<!>,
<!ANNOTATION_PARAMETER_MUST_BE_CONST!>"$a1 $topLevel"<!>,
<!ANNOTATION_PARAMETER_MUST_BE_CONST!>"$a4"<!>,
<!ANNOTATION_PARAMETER_MUST_BE_CONST!>"$a5"<!>,
<!ANNOTATION_PARAMETER_MUST_BE_CONST!>a1 + a2<!>,
<!ANNOTATION_PARAMETER_MUST_BE_CONST!>"a" + a2<!>,
"a" + topLevel,
<!ANNOTATION_PARAMETER_MUST_BE_CONST!>"a" + a4<!>
)] val b = 1
}