Prohibit OptionalExpectation on nested annotation classes

Because the new generation scheme based on module metadata does not
support them, and we don't plan to have them in the standard library
yet.
This commit is contained in:
Alexander Udalov
2020-05-11 20:36:06 +02:00
parent 012ffa2993
commit 4597fff18a
8 changed files with 59 additions and 31 deletions
@@ -18,3 +18,10 @@ annotation class InOtherAnnotation(val a: A)
@InOtherAnnotation(A())
fun useInOtherAnnotation() {}
expect class C {
@OptionalExpectation
annotation class Nested
}
@@ -4,3 +4,7 @@ annotation class AnotherAnnotation(val a: A)
@AnotherAnnotation(A())
fun useInAnotherAnnotation() {}
actual class C {
actual annotation class Nested
}
@@ -16,6 +16,9 @@ annotation class InOtherAnnotation(val a: A)
compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt:19:20: error: declaration annotated with '@OptionalExpectation' can only be used inside an annotation entry
@InOtherAnnotation(A())
^
compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt:25:5: error: '@OptionalExpectation' cannot be used on a nested class
@OptionalExpectation
^
-- JVM --
Exit code: COMPILATION_ERROR
@@ -38,6 +41,9 @@ annotation class InOtherAnnotation(val a: A)
compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt:19:20: error: declaration annotated with '@OptionalExpectation' can only be used inside an annotation entry
@InOtherAnnotation(A())
^
compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt:25:5: error: '@OptionalExpectation' cannot be used on a nested class
@OptionalExpectation
^
compiler/testData/multiplatform/optionalExpectationIncorrectUse/jvm.kt:1:24: error: declaration annotated with '@OptionalExpectation' can only be used inside an annotation entry
fun useInReturnType(): A? = null
^