From de60c9b635acfc6a5bf40896b2dcb27d1553dfb0 Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Mon, 2 Jul 2018 03:41:18 +0300 Subject: [PATCH] Fix language features in tests for gradual migration to 1.3 version --- .../enumConst_after.kt | 15 ++++ .../{enumConst.txt => enumConst_after.txt} | 0 .../{enumConst.kt => enumConst_before.kt} | 2 + .../enumConst_before.txt | 44 +++++++++ .../annotations/kt1886annotationBody_after.kt | 31 +++++++ ...ody.txt => kt1886annotationBody_after.txt} | 0 ...Body.kt => kt1886annotationBody_before.kt} | 2 + .../kt1886annotationBody_before.txt | 90 +++++++++++++++++++ .../fileAnnotationWithoutColon_after.kt | 11 +++ ...t => fileAnnotationWithoutColon_after.txt} | 0 ...t => fileAnnotationWithoutColon_before.kt} | 1 + .../fileAnnotationWithoutColon_before.txt | 12 +++ ...rUseSiteTargetOnExtensionFunction_after.kt | 10 +++ ...seSiteTargetOnExtensionFunction_after.txt} | 0 ...seSiteTargetOnExtensionFunction_before.kt} | 2 + ...seSiteTargetOnExtensionFunction_before.txt | 13 +++ .../wrongParamAnnotationsOnTypes_after.kt | 13 +++ ...=> wrongParamAnnotationsOnTypes_after.txt} | 0 ...=> wrongParamAnnotationsOnTypes_before.kt} | 1 + .../wrongParamAnnotationsOnTypes_before.txt | 9 ++ .../checkers/DiagnosticsTestGenerated.java | 59 ++++++++---- .../DiagnosticsUsingJavacTestGenerated.java | 59 ++++++++---- 22 files changed, 340 insertions(+), 34 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_after.kt rename compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/{enumConst.txt => enumConst_after.txt} (100%) rename compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/{enumConst.kt => enumConst_before.kt} (76%) create mode 100644 compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_before.txt create mode 100644 compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_after.kt rename compiler/testData/diagnostics/tests/annotations/{kt1886annotationBody.txt => kt1886annotationBody_after.txt} (100%) rename compiler/testData/diagnostics/tests/annotations/{kt1886annotationBody.kt => kt1886annotationBody_before.kt} (94%) create mode 100644 compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.txt create mode 100644 compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_after.kt rename compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/{fileAnnotationWithoutColon.txt => fileAnnotationWithoutColon_after.txt} (100%) rename compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/{fileAnnotationWithoutColon.kt => fileAnnotationWithoutColon_before.kt} (89%) create mode 100644 compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_before.txt create mode 100644 compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_after.kt rename compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/{receiverUseSiteTargetOnExtensionFunction.txt => receiverUseSiteTargetOnExtensionFunction_after.txt} (100%) rename compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/{receiverUseSiteTargetOnExtensionFunction.kt => receiverUseSiteTargetOnExtensionFunction_before.kt} (84%) create mode 100644 compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_before.txt create mode 100644 compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_after.kt rename compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/{wrongParamAnnotationsOnTypes.txt => wrongParamAnnotationsOnTypes_after.txt} (100%) rename compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/{wrongParamAnnotationsOnTypes.kt => wrongParamAnnotationsOnTypes_before.kt} (91%) create mode 100644 compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_before.txt diff --git a/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_after.kt b/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_after.kt new file mode 100644 index 00000000000..44f7626bf03 --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_after.kt @@ -0,0 +1,15 @@ +// !LANGUAGE: +ProhibitNonConstValuesAsVarargsInAnnotations + +annotation class AnnE(val i: MyEnum) + +@AnnE(e) +class Test + +val e: MyEnum = MyEnum.A + +enum class MyEnum { + A +} + +@AnnE(Test()) +class Test2 \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst.txt b/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_after.txt similarity index 100% rename from compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst.txt rename to compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_after.txt diff --git a/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst.kt b/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_before.kt similarity index 76% rename from compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst.kt rename to compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_before.kt index 0a56d7740c0..c226e0922c2 100644 --- a/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst.kt +++ b/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_before.kt @@ -1,3 +1,5 @@ +// !LANGUAGE: -ProhibitNonConstValuesAsVarargsInAnnotations + annotation class AnnE(val i: MyEnum) @AnnE(e) diff --git a/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_before.txt b/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_before.txt new file mode 100644 index 00000000000..77a5e81631a --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_before.txt @@ -0,0 +1,44 @@ +package + +public val e: MyEnum + +public final annotation class AnnE : kotlin.Annotation { + public constructor AnnE(/*0*/ i: MyEnum) + public final val i: MyEnum + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final enum class MyEnum : kotlin.Enum { + enum entry A + + private constructor MyEnum() + public final override /*1*/ /*fake_override*/ val name: kotlin.String + public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int + protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MyEnum): kotlin.Int + public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit + public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! + public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): MyEnum + public final /*synthesized*/ fun values(): kotlin.Array +} + +@AnnE public final class Test { + public constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +@AnnE public final class Test2 { + public constructor Test2() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_after.kt b/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_after.kt new file mode 100644 index 00000000000..f659434ca30 --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_after.kt @@ -0,0 +1,31 @@ +// !LANGUAGE: +NestedClassesInAnnotations + +annotation class Annotation2() { + public val s: String = "" +} + +annotation class Annotation3() { + public fun foo() {} +} + +annotation class Annotation4() { + class Foo() {} +} + +annotation class Annotation5() { + companion object {} +} + +annotation class Annotation6() { + init {} +} + +annotation class Annotation1() {} + +annotation class Annotation7(val name: String) {} + +annotation class Annotation8(var name: String = "") {} + +annotation class Annotation9(val name: String) + +annotation class Annotation10 diff --git a/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody.txt b/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_after.txt similarity index 100% rename from compiler/testData/diagnostics/tests/annotations/kt1886annotationBody.txt rename to compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_after.txt diff --git a/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody.kt b/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.kt similarity index 94% rename from compiler/testData/diagnostics/tests/annotations/kt1886annotationBody.kt rename to compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.kt index dc2ceb0f63e..b8d0118a25c 100644 --- a/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody.kt +++ b/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.kt @@ -1,3 +1,5 @@ +// !LANGUAGE: -NestedClassesInAnnotations + annotation class Annotation2() { public val s: String = "" } diff --git a/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.txt b/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.txt new file mode 100644 index 00000000000..57776614ef0 --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.txt @@ -0,0 +1,90 @@ +package + +public final annotation class Annotation1 : kotlin.Annotation { + public constructor Annotation1() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final annotation class Annotation10 : kotlin.Annotation { + public constructor Annotation10() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final annotation class Annotation2 : kotlin.Annotation { + public constructor Annotation2() + public final val s: kotlin.String = "" + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final annotation class Annotation3 : kotlin.Annotation { + public constructor Annotation3() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final annotation class Annotation4 : kotlin.Annotation { + public constructor Annotation4() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final class Foo { + public constructor Foo() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +public final annotation class Annotation5 : kotlin.Annotation { + public constructor Annotation5() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public companion object Companion { + private constructor Companion() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +public final annotation class Annotation6 : kotlin.Annotation { + public constructor Annotation6() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final annotation class Annotation7 : kotlin.Annotation { + public constructor Annotation7(/*0*/ name: kotlin.String) + public final val name: kotlin.String + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final annotation class Annotation8 : kotlin.Annotation { + public constructor Annotation8(/*0*/ name: kotlin.String = ...) + public final var name: kotlin.String + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final annotation class Annotation9 : kotlin.Annotation { + public constructor Annotation9(/*0*/ name: kotlin.String) + public final val name: kotlin.String + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_after.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_after.kt new file mode 100644 index 00000000000..53595f77bca --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_after.kt @@ -0,0 +1,11 @@ +// !LANGUAGE: +RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes +// !DIAGNOSTICS: -UNUSED_PARAMETER + +fun test1(@file Suppress("") x: Int) {} + +@file @Suppress("") +fun test2() {} + +class OnType(x: @file Suppress("") Int) + +fun @file : Suppress("") Int.test3() {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_after.txt similarity index 100% rename from compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon.txt rename to compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_after.txt diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_before.kt similarity index 89% rename from compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon.kt rename to compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_before.kt index 746004b3f08..4c5d23f349d 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_before.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: -RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes // !DIAGNOSTICS: -UNUSED_PARAMETER fun test1(@file Suppress("") x: Int) {} diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_before.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_before.txt new file mode 100644 index 00000000000..bd38106f5ba --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_before.txt @@ -0,0 +1,12 @@ +package + +public fun test1(/*0*/ @file:kotlin.Suppress(names = {""}) x: kotlin.Int): kotlin.Unit +@file:kotlin.Suppress(names = {""}) public fun test2(): kotlin.Unit +public fun @file:kotlin.Suppress(names = {""}) kotlin.Int.test3(): kotlin.Unit + +public final class OnType { + public constructor OnType(/*0*/ x: @file:kotlin.Suppress(names = {""}) kotlin.Int) + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_after.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_after.kt new file mode 100644 index 00000000000..659613289bf --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_after.kt @@ -0,0 +1,10 @@ +// !LANGUAGE: +RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes + +@Target(AnnotationTarget.VALUE_PARAMETER) +annotation class Fancy + +fun @receiver:Fancy String.myExtension() { } +val @receiver:Fancy Int.asVal get() = 0 + +fun ((@receiver:Fancy Int) -> Unit).complexReceiver1() {} +fun ((Int) -> @receiver:Fancy Unit).complexReceiver2() {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_after.txt similarity index 100% rename from compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction.txt rename to compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_after.txt diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_before.kt similarity index 84% rename from compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction.kt rename to compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_before.kt index 2c8e6298537..cc06a2fcd88 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_before.kt @@ -1,3 +1,5 @@ +// !LANGUAGE: -RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes + @Target(AnnotationTarget.VALUE_PARAMETER) annotation class Fancy diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_before.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_before.txt new file mode 100644 index 00000000000..4036b4ab0c4 --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_before.txt @@ -0,0 +1,13 @@ +package + +public val @receiver:Fancy kotlin.Int.asVal: kotlin.Int +public fun ((@receiver:Fancy kotlin.Int) -> kotlin.Unit).complexReceiver1(): kotlin.Unit +public fun ((kotlin.Int) -> @receiver:Fancy kotlin.Unit).complexReceiver2(): kotlin.Unit +public fun @receiver:Fancy kotlin.String.myExtension(): kotlin.Unit + +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) public final annotation class Fancy : kotlin.Annotation { + public constructor Fancy() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_after.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_after.kt new file mode 100644 index 00000000000..41ee053c1e4 --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_after.kt @@ -0,0 +1,13 @@ +// !LANGUAGE: +RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes +// !DIAGNOSTICS: -UNUSED_PARAMETER + +fun test1(i: @setparam:Suppress Int) {} +fun test2(i: @param:Suppress Int) {} +fun test3(i: @receiver:Suppress Int) {} + +fun test4(): @setparam:Suppress Int = TODO() +fun test5(i: (@setparam:Suppress Int) -> Unit) {} + +fun ((@setparam:Suppress Int) -> Unit).test6() {} + +fun test7(): ((@setparam:Suppress Int) -> Unit) = TODO() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_after.txt similarity index 100% rename from compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes.txt rename to compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_after.txt diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_before.kt similarity index 91% rename from compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes.kt rename to compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_before.kt index c32ef8fa211..43a7e51b68a 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_before.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: -RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes // !DIAGNOSTICS: -UNUSED_PARAMETER fun test1(i: @setparam:Suppress Int) {} diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_before.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_before.txt new file mode 100644 index 00000000000..7f4539dbea7 --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_before.txt @@ -0,0 +1,9 @@ +package + +public fun test1(/*0*/ i: @setparam:kotlin.Suppress(names = {}) kotlin.Int): kotlin.Unit +public fun test2(/*0*/ i: @param:kotlin.Suppress(names = {}) kotlin.Int): kotlin.Unit +public fun test3(/*0*/ i: @receiver:kotlin.Suppress(names = {}) kotlin.Int): kotlin.Unit +public fun test4(): @setparam:kotlin.Suppress(names = {}) kotlin.Int +public fun test5(/*0*/ i: (@setparam:kotlin.Suppress(names = {}) kotlin.Int) -> kotlin.Unit): kotlin.Unit +public fun test7(): (@setparam:kotlin.Suppress(names = {}) kotlin.Int) -> kotlin.Unit +public fun ((@setparam:kotlin.Suppress(names = {}) kotlin.Int) -> kotlin.Unit).test6(): kotlin.Unit diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 8e4f2e8ab4f..4d1289b9fd6 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -953,9 +953,14 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { runTest("compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt"); } - @TestMetadata("kt1886annotationBody.kt") - public void testKt1886annotationBody() throws Exception { - runTest("compiler/testData/diagnostics/tests/annotations/kt1886annotationBody.kt"); + @TestMetadata("kt1886annotationBody_after.kt") + public void testKt1886annotationBody_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_after.kt"); + } + + @TestMetadata("kt1886annotationBody_before.kt") + public void testKt1886annotationBody_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.kt"); } @TestMetadata("missingValOnParameter.kt") @@ -1115,9 +1120,14 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { runTest("compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/compareAndEquals.kt"); } - @TestMetadata("enumConst.kt") - public void testEnumConst() throws Exception { - runTest("compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst.kt"); + @TestMetadata("enumConst_after.kt") + public void testEnumConst_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_after.kt"); + } + + @TestMetadata("enumConst_before.kt") + public void testEnumConst_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_before.kt"); } @TestMetadata("javaProperties.kt") @@ -1404,9 +1414,14 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.kt"); } - @TestMetadata("fileAnnotationWithoutColon.kt") - public void testFileAnnotationWithoutColon() throws Exception { - runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon.kt"); + @TestMetadata("fileAnnotationWithoutColon_after.kt") + public void testFileAnnotationWithoutColon_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_after.kt"); + } + + @TestMetadata("fileAnnotationWithoutColon_before.kt") + public void testFileAnnotationWithoutColon_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_before.kt"); } @TestMetadata("FileAnnotations.kt") @@ -1434,9 +1449,14 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/ReceiverAnnotations.kt"); } - @TestMetadata("receiverUseSiteTargetOnExtensionFunction.kt") - public void testReceiverUseSiteTargetOnExtensionFunction() throws Exception { - runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction.kt"); + @TestMetadata("receiverUseSiteTargetOnExtensionFunction_after.kt") + public void testReceiverUseSiteTargetOnExtensionFunction_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_after.kt"); + } + + @TestMetadata("receiverUseSiteTargetOnExtensionFunction_before.kt") + public void testReceiverUseSiteTargetOnExtensionFunction_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_before.kt"); } @TestMetadata("repeatable.kt") @@ -1454,15 +1474,20 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.kt"); } - @TestMetadata("wrongParamAnnotationsOnTypes.kt") - public void testWrongParamAnnotationsOnTypes() throws Exception { - runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes.kt"); - } - @TestMetadata("wrongParamAnnotationsOnTypesError.kt") public void testWrongParamAnnotationsOnTypesError() throws Exception { runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypesError.kt"); } + + @TestMetadata("wrongParamAnnotationsOnTypes_after.kt") + public void testWrongParamAnnotationsOnTypes_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_after.kt"); + } + + @TestMetadata("wrongParamAnnotationsOnTypes_before.kt") + public void testWrongParamAnnotationsOnTypes_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_before.kt"); + } } } diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 55f26124b07..3be6cf94dbb 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -953,9 +953,14 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt"); } - @TestMetadata("kt1886annotationBody.kt") - public void testKt1886annotationBody() throws Exception { - runTest("compiler/testData/diagnostics/tests/annotations/kt1886annotationBody.kt"); + @TestMetadata("kt1886annotationBody_after.kt") + public void testKt1886annotationBody_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_after.kt"); + } + + @TestMetadata("kt1886annotationBody_before.kt") + public void testKt1886annotationBody_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.kt"); } @TestMetadata("missingValOnParameter.kt") @@ -1115,9 +1120,14 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/compareAndEquals.kt"); } - @TestMetadata("enumConst.kt") - public void testEnumConst() throws Exception { - runTest("compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst.kt"); + @TestMetadata("enumConst_after.kt") + public void testEnumConst_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_after.kt"); + } + + @TestMetadata("enumConst_before.kt") + public void testEnumConst_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/annotationParameterMustBeConstant/enumConst_before.kt"); } @TestMetadata("javaProperties.kt") @@ -1404,9 +1414,14 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.kt"); } - @TestMetadata("fileAnnotationWithoutColon.kt") - public void testFileAnnotationWithoutColon() throws Exception { - runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon.kt"); + @TestMetadata("fileAnnotationWithoutColon_after.kt") + public void testFileAnnotationWithoutColon_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_after.kt"); + } + + @TestMetadata("fileAnnotationWithoutColon_before.kt") + public void testFileAnnotationWithoutColon_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/fileAnnotationWithoutColon_before.kt"); } @TestMetadata("FileAnnotations.kt") @@ -1434,9 +1449,14 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/ReceiverAnnotations.kt"); } - @TestMetadata("receiverUseSiteTargetOnExtensionFunction.kt") - public void testReceiverUseSiteTargetOnExtensionFunction() throws Exception { - runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction.kt"); + @TestMetadata("receiverUseSiteTargetOnExtensionFunction_after.kt") + public void testReceiverUseSiteTargetOnExtensionFunction_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_after.kt"); + } + + @TestMetadata("receiverUseSiteTargetOnExtensionFunction_before.kt") + public void testReceiverUseSiteTargetOnExtensionFunction_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/receiverUseSiteTargetOnExtensionFunction_before.kt"); } @TestMetadata("repeatable.kt") @@ -1454,15 +1474,20 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.kt"); } - @TestMetadata("wrongParamAnnotationsOnTypes.kt") - public void testWrongParamAnnotationsOnTypes() throws Exception { - runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes.kt"); - } - @TestMetadata("wrongParamAnnotationsOnTypesError.kt") public void testWrongParamAnnotationsOnTypesError() throws Exception { runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypesError.kt"); } + + @TestMetadata("wrongParamAnnotationsOnTypes_after.kt") + public void testWrongParamAnnotationsOnTypes_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_after.kt"); + } + + @TestMetadata("wrongParamAnnotationsOnTypes_before.kt") + public void testWrongParamAnnotationsOnTypes_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/wrongParamAnnotationsOnTypes_before.kt"); + } } }