From 4fe846fb81e06bd3242cdd651f144fd2fc361fcc Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Mon, 26 Jul 2021 11:53:41 +0200 Subject: [PATCH] Fix test affected by `InstantiationOfAnnotationClasses` feature --- .../tests/annotations/ConstructorCall.fir.kt | 1 + .../tests/annotations/ConstructorCall.kt | 1 + .../typeAliasConstructorWrongClass.kt | 4 +-- .../array.kt | 2 +- .../vararg.fir.kt | 27 +++++++++++++++++++ .../vararg.kt | 3 +-- 6 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.fir.kt diff --git a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt b/compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt index edaa2e8d534..2c95786fc89 100644 --- a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: -InstantiationOfAnnotationClasses annotation class Ann annotation class Ann1(val a: Int) annotation class Ann2(val a: Ann1) diff --git a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt b/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt index cb2f5c0017e..84909803e70 100644 --- a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt +++ b/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: -InstantiationOfAnnotationClasses annotation class Ann annotation class Ann1(val a: Int) annotation class Ann2(val a: Ann1) diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongClass.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongClass.kt index cafaeda2aa2..ef4b6456567 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongClass.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongClass.kt @@ -7,8 +7,8 @@ val test1a = AbstractClass() annotation class AnnotationClass typealias Test2 = AnnotationClass -val test2 = Test2() -val test2a = AnnotationClass() +val test2 = Test2() +val test2a = AnnotationClass() enum class EnumClass { VALUE1, VALUE2 } typealias Test3 = EnumClass diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.kt index 8dca3f86c86..bd5dd5c0b84 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.kt @@ -21,4 +21,4 @@ annotation class AnnAnn(val i: Array) @AnnAnn(arrayOf(Ann(intArrayOf(1)))) @AnnAnn(arrayOf(iAnn)) class TestAnn -val iAnn = Ann(intArrayOf(1)) +val iAnn = Ann(intArrayOf(1)) diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.fir.kt new file mode 100644 index 00000000000..3d3670e3826 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.fir.kt @@ -0,0 +1,27 @@ +@Retention(AnnotationRetention.SOURCE) +@Repeatable +annotation class Ann(vararg val i: Int) + +@Ann(i) +@Ann(i2) +@Ann(i3) +@Ann(i, i2, i3) +@Ann(*intArrayOf(i)) +@Ann(*intArrayOf(i2)) +@Ann(*intArrayOf(i3)) +@Ann(*intArrayOf(i, i2, i3)) +class Test + +var i = 1 +const val i2 = 1 +val i3 = foo() + +fun foo(): Int = 1 + +@Retention(AnnotationRetention.SOURCE) +@Repeatable +annotation class AnnAnn(vararg val i: Ann) +@AnnAnn(*arrayOf(Ann(1))) +@AnnAnn(*arrayOf(iAnn)) +class TestAnn +val iAnn = Ann(1) diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.kt index 7dfee388236..ac380240bc3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL @Retention(AnnotationRetention.SOURCE) @Repeatable annotation class Ann(vararg val i: Int) @@ -25,4 +24,4 @@ annotation class AnnAnn(vararg val i: Ann) @AnnAnn(*arrayOf(Ann(1))) @AnnAnn(*arrayOf(iAnn)) class TestAnn -val iAnn = Ann(1) +val iAnn = Ann(1)