Annotation target checking in front-end, a set of tests for different annotation targets, existing test fixes

No checks for erroneous annotations. Additional checks for identifiers.
This commit is contained in:
Mikhail Glukhikh
2015-07-06 20:00:06 +03:00
parent 609d696202
commit 0d2a81f098
82 changed files with 1445 additions and 46 deletions
@@ -114,6 +114,7 @@ public interface Errors {
DiagnosticFactory2<PsiElement, JetModifierKeywordToken, JetModifierKeywordToken> REDUNDANT_MODIFIER = DiagnosticFactory2.create(WARNING);
DiagnosticFactory0<PsiElement> INAPPLICABLE_ANNOTATION = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<PsiElement> INAPPLICABLE_PLATFORM_NAME = DiagnosticFactory0.create(ERROR);
DiagnosticFactory1<PsiElement, String> WRONG_ANNOTATION_TARGET = DiagnosticFactory1.create(ERROR);
// Annotations
@@ -137,6 +137,7 @@ public class DefaultErrorMessages {
MAP.put(REPEATED_MODIFIER, "Repeated ''{0}''", TO_STRING);
MAP.put(INAPPLICABLE_ANNOTATION, "This annotation is only applicable to top level functions");
MAP.put(INAPPLICABLE_PLATFORM_NAME, "platformName annotation is not applicable to this declaration");
MAP.put(WRONG_ANNOTATION_TARGET, "This annotation is not applicable to target ''{0}''", TO_STRING);
MAP.put(REDUNDANT_MODIFIER, "Modifier ''{0}'' is redundant because ''{1}'' is present", TO_STRING, TO_STRING);
MAP.put(ABSTRACT_MODIFIER_IN_TRAIT, "Modifier ''abstract'' is redundant in interface");
@@ -0,0 +1,135 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.resolve
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.getAnnotationEntries
import org.jetbrains.kotlin.resolve.constants.ArrayValue
import org.jetbrains.kotlin.resolve.constants.EnumValue
import org.jetbrains.kotlin.types.JetType
import org.jetbrains.kotlin.types.TypeUtils
import java.util.*
public object AnnotationTargetChecker {
// NOTE: this enum must have the same entries with kotlin.annotation.AnnotationTarget
public enum class Target(val description: String, val isDefault: Boolean = true) {
PACKAGE("package"),
CLASSIFIER("classifier"),
ANNOTATION_CLASS("annotation class"),
TYPE_PARAMETER("type parameter", false),
PROPERTY("property"),
FIELD("field"),
LOCAL_VARIABLE("local variable"),
VALUE_PARAMETER("value parameter"),
CONSTRUCTOR("constructor"),
FUNCTION("function"),
PROPERTY_GETTER("getter"),
PROPERTY_SETTER("setter"),
TYPE("type usage", false),
EXPRESSION("expression", false),
FILE("file", false)
}
private val DEFAULT_TARGET_LIST = Target.values().filter { it.isDefault }.map { it.name() }
private val ALL_TARGET_LIST = Target.values().map { it.name() }
public fun check(annotated: JetAnnotated, trace: BindingTrace) {
if (annotated is JetTypeParameter) return // TODO: support type parameter annotations
val actualTargets = getActualTargetList(annotated)
for (entry in annotated.getAnnotationEntries()) {
checkAnnotationEntry(entry, actualTargets, trace)
}
if (annotated is JetCallableDeclaration) {
annotated.getTypeReference()?.let { check(it, trace) }
}
if (annotated is JetFunction) {
for (parameter in annotated.getValueParameters()) {
if (!parameter.hasValOrVar()) {
check(parameter, trace)
if (annotated is JetFunctionLiteral) {
parameter.getTypeReference()?.let { check(it, trace) }
}
}
}
}
if (annotated is JetClassOrObject) {
for (initializer in annotated.getAnonymousInitializers()) {
check(initializer, trace)
}
}
}
public fun checkExpression(expression: JetExpression, trace: BindingTrace) {
for (entry in expression.getAnnotationEntries()) {
checkAnnotationEntry(entry, listOf(Target.EXPRESSION), trace)
}
if (expression is JetFunctionLiteralExpression) {
for (parameter in expression.getValueParameters()) {
parameter.getTypeReference()?.let { check(it, trace) }
}
}
}
private fun possibleTargetList(entry: JetAnnotationEntry, trace: BindingTrace): List<String> {
val descriptor = trace.get(BindingContext.ANNOTATION, entry) ?: return DEFAULT_TARGET_LIST
// For descriptor with error type, all targets are considered as possible
if (descriptor.getType().isError()) return ALL_TARGET_LIST
val classDescriptor = TypeUtils.getClassDescriptor(descriptor.getType()) ?: return DEFAULT_TARGET_LIST
val targetEntryDescriptor = classDescriptor.getAnnotations().findAnnotation(KotlinBuiltIns.FQ_NAMES.target)
?: return DEFAULT_TARGET_LIST
val valueArguments = targetEntryDescriptor.getAllValueArguments()
val valueArgument = valueArguments.entrySet().firstOrNull()?.getValue() as? ArrayValue ?: return DEFAULT_TARGET_LIST
return valueArgument.getValue().filterIsInstance<EnumValue>().map { it.getValue().getName().asString() }
}
private fun checkAnnotationEntry(entry: JetAnnotationEntry, actualTargets: List<Target>, trace: BindingTrace) {
val possibleTargets = possibleTargetList(entry, trace)
for (actualTarget in actualTargets) {
if (actualTarget.name() in possibleTargets) return
}
trace.report(Errors.WRONG_ANNOTATION_TARGET.on(entry, actualTargets.firstOrNull()?.description ?: "unidentified target"))
}
private fun getActualTargetList(annotated: JetAnnotated): List<Target> {
if (annotated is JetClassOrObject) {
if (annotated is JetEnumEntry) return listOf(Target.PROPERTY, Target.FIELD)
return if (annotated.isAnnotation()) listOf(Target.ANNOTATION_CLASS, Target.CLASSIFIER) else listOf(Target.CLASSIFIER)
}
if (annotated is JetProperty) {
return if (annotated.isLocal()) listOf(Target.LOCAL_VARIABLE) else listOf(Target.PROPERTY, Target.FIELD)
}
if (annotated is JetParameter) {
return if (annotated.hasValOrVar()) listOf(Target.PROPERTY, Target.FIELD) else listOf(Target.VALUE_PARAMETER)
}
if (annotated is JetConstructor<*>) return listOf(Target.CONSTRUCTOR)
if (annotated is JetFunction) return listOf(Target.FUNCTION)
if (annotated is JetPropertyAccessor) {
return if (annotated.isGetter()) listOf(Target.PROPERTY_GETTER) else listOf(Target.PROPERTY_SETTER)
}
if (annotated is JetPackageDirective) return listOf(Target.PACKAGE)
if (annotated is JetTypeReference) return listOf(Target.TYPE)
if (annotated is JetFile) return listOf(Target.FILE)
if (annotated is JetTypeParameter) return listOf(Target.TYPE_PARAMETER)
return listOf()
}
}
@@ -67,6 +67,7 @@ public class DeclarationsChecker {
public void process(@NotNull BodiesResolveContext bodiesResolveContext) {
for (JetFile file : bodiesResolveContext.getFiles()) {
checkModifiersAndAnnotationsInPackageDirective(file);
AnnotationTargetChecker.INSTANCE$.check(file, trace);
}
Map<JetClassOrObject, ClassDescriptorWithResolutionScopes> classes = bodiesResolveContext.getDeclaredClasses();
@@ -146,6 +147,7 @@ public class DeclarationsChecker {
}
}
}
AnnotationTargetChecker.INSTANCE$.check(packageDirective, trace);
ModifiersChecker.reportIllegalModifiers(modifierList, Arrays.asList(JetTokens.MODIFIER_KEYWORDS_ARRAY), trace);
}
@@ -302,6 +304,7 @@ public class DeclarationsChecker {
if (typeParameter != null) {
DescriptorResolver.checkConflictingUpperBounds(trace, typeParameter, jetTypeParameter);
}
AnnotationTargetChecker.INSTANCE$.check(jetTypeParameter, trace);
}
}
@@ -150,6 +150,7 @@ public class ModifiersChecker {
}
checkPlatformNameApplicability(descriptor);
runDeclarationCheckers(modifierListOwner, descriptor);
AnnotationTargetChecker.INSTANCE$.check(modifierListOwner, trace);
}
private void checkVarargsModifiers(@NotNull JetDeclaration owner, @NotNull MemberDescriptor descriptor) {
@@ -163,6 +164,7 @@ public class ModifiersChecker {
reportIllegalVisibilityModifiers(modifierListOwner);
checkPlatformNameApplicability(descriptor);
runDeclarationCheckers(modifierListOwner, descriptor);
AnnotationTargetChecker.INSTANCE$.check(modifierListOwner, trace);
}
public void reportIllegalModalityModifiers(@NotNull JetModifierListOwner modifierListOwner) {
@@ -24,6 +24,7 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils;
import org.jetbrains.kotlin.diagnostics.Errors;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.AnnotationTargetChecker;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingContextUtils;
import org.jetbrains.kotlin.resolve.scopes.WritableScope;
@@ -143,7 +144,9 @@ public class ExpressionTypingVisitorDispatcher extends JetVisitor<JetTypeInfo, E
@Override
@NotNull
public final JetTypeInfo getTypeInfo(@NotNull JetExpression expression, ExpressionTypingContext context) {
return getTypeInfo(expression, context, this);
JetTypeInfo result = getTypeInfo(expression, context, this);
AnnotationTargetChecker.INSTANCE$.checkExpression(expression, context.trace);
return result;
}
@Override
@@ -29,10 +29,7 @@ import org.jetbrains.kotlin.diagnostics.Errors;
import org.jetbrains.kotlin.lexer.JetTokens;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.AnnotationResolver;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.ModifiersChecker;
import org.jetbrains.kotlin.resolve.TemporaryBindingTrace;
import org.jetbrains.kotlin.resolve.*;
import org.jetbrains.kotlin.resolve.calls.context.TemporaryTraceAndCache;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults;
@@ -1,5 +1,6 @@
package foo
target(AnnotationTarget.CLASSIFIER, AnnotationTarget.FUNCTION, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION)
annotation class fancy
@fancy
@@ -1,4 +1,4 @@
compiler/testData/cli/js/diagnosticForUnhandledElements.kt:9:17: error: cannot translate (not supported yet): '@fancy 1'
compiler/testData/cli/js/diagnosticForUnhandledElements.kt:10:17: error: cannot translate (not supported yet): '@fancy 1'
return (@fancy 1)
^
COMPILATION_ERROR
@@ -1,10 +1,9 @@
import java.lang.annotation.*
import java.lang.reflect.Method
import kotlin.reflect.jvm.java
import kotlin.test.assertEquals
Retention(RetentionPolicy.RUNTIME)
annotation class Ann(val x: String)
target(AnnotationTarget.EXPRESSION)
annotation(retention = AnnotationRetention.RUNTIME) class Ann(val x: String)
fun testMethod(method: Method, name: String) {
assertEquals("OK", method.getAnnotation(javaClass<Ann>()).x, "On method of test named `$name`")
@@ -1,10 +1,9 @@
import java.lang.annotation.*
import java.lang.reflect.Method
import kotlin.reflect.jvm.java
import kotlin.test.assertEquals
Retention(RetentionPolicy.RUNTIME)
annotation class Ann(val x: String)
target(AnnotationTarget.EXPRESSION)
annotation(retention = AnnotationRetention.RUNTIME) class Ann(val x: String)
fun foo0(block: () -> Unit) = block.javaClass
+1 -1
View File
@@ -18,6 +18,6 @@ fun test() : Unit {
val <!UNUSED_VARIABLE!>s<!> = "" <!USELESS_CAST!>as Any<!>
("" as String?)?.length()
(data@("" as String?))?.length()
(@data()( "" as String?))?.length()
(<!WRONG_ANNOTATION_TARGET!>@data()<!>( "" as String?))?.length()
Unit
}
@@ -1,4 +1,5 @@
// Result type can be annotated
target(AnnotationTarget.TYPE)
annotation class My(val x: Int)
fun foo(): @My(42) Int = 24
@@ -2,7 +2,7 @@ package
internal fun foo(): @[My(x = IntegerValueType(42))] kotlin.Int
kotlin.annotation.annotation() internal final annotation class My : kotlin.Annotation {
kotlin.annotation.target(allowedTargets = {AnnotationTarget.TYPE}) kotlin.annotation.annotation() internal final annotation class My : kotlin.Annotation {
public constructor My(/*0*/ x: kotlin.Int)
internal final val x: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -1,2 +1,3 @@
// Class constructor parameter type CAN be recursively annotated
target(AnnotationTarget.TYPE)
annotation class RecursivelyAnnotated(val x: @RecursivelyAnnotated(1) Int)
@@ -1,6 +1,6 @@
package
kotlin.annotation.annotation() internal final annotation class RecursivelyAnnotated : kotlin.Annotation {
kotlin.annotation.target(allowedTargets = {AnnotationTarget.TYPE}) kotlin.annotation.annotation() internal final annotation class RecursivelyAnnotated : kotlin.Annotation {
public constructor RecursivelyAnnotated(/*0*/ x: @[RecursivelyAnnotated(x = IntegerValueType(1))] kotlin.Int)
internal final val x: @[RecursivelyAnnotated(x = IntegerValueType(1))] kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -8,8 +8,8 @@ annotation object O {}
annotation interface T {}
annotation fun f() = 0
<!WRONG_ANNOTATION_TARGET!>annotation<!> fun f() = 0
annotation val x = 0
<!WRONG_ANNOTATION_TARGET!>annotation<!> val x = 0
annotation var y = 0
<!WRONG_ANNOTATION_TARGET!>annotation<!> var y = 0
@@ -1,4 +1,5 @@
annotation class Ann(val x: Int = 1)
target(AnnotationTarget.EXPRESSION)
annotation(repeatable = true) class Ann(val x: Int = 1)
inline fun bar(block: () -> Int): Int = block()
@@ -3,7 +3,7 @@ package
kotlin.inline() internal fun bar(/*0*/ block: () -> kotlin.Int): kotlin.Int
internal fun foo(): kotlin.Unit
kotlin.annotation.annotation() internal final annotation class Ann : kotlin.Annotation {
kotlin.annotation.target(allowedTargets = {AnnotationTarget.EXPRESSION}) kotlin.annotation.annotation(repeatable = true) internal final annotation class Ann : kotlin.Annotation {
public constructor Ann(/*0*/ x: kotlin.Int = ...)
internal final val x: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -1,5 +1,8 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
annotation class Ann(val x: Int = 6)
target(AnnotationTarget.TYPE, AnnotationTarget.CLASSIFIER,
AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION,
AnnotationTarget.EXPRESSION, AnnotationTarget.PROPERTY)
annotation(repeatable = true) class Ann(val x: Int = 6)
@Ann(1) @Ann(2) @Ann(3) @private class A @Ann constructor() {
@Ann(x = 5) fun foo() {
@@ -10,7 +10,7 @@ Ann(x = IntegerValueType(1)) Ann(x = IntegerValueType(2)) Ann(x = IntegerValueTy
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
kotlin.annotation.annotation() internal final annotation class Ann : kotlin.Annotation {
kotlin.annotation.target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.CLASSIFIER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.EXPRESSION, AnnotationTarget.PROPERTY}) kotlin.annotation.annotation(repeatable = true) internal final annotation class Ann : kotlin.Annotation {
public constructor Ann(/*0*/ x: kotlin.Int = ...)
internal final val x: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -1,3 +1,4 @@
target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION)
annotation class test
fun foo(test <!UNUSED_PARAMETER!>f<!> : Int) {}
@@ -11,7 +11,7 @@ internal final class Hello {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
kotlin.annotation.annotation() internal final annotation class test : kotlin.Annotation {
kotlin.annotation.target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.EXPRESSION}) kotlin.annotation.annotation() internal final annotation class test : kotlin.Annotation {
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
@@ -1,3 +1,4 @@
fun foo() = @ann 1
target(AnnotationTarget.EXPRESSION)
annotation class ann
@@ -2,7 +2,7 @@ package
internal fun foo(): kotlin.Int
kotlin.annotation.annotation() internal final annotation class ann : kotlin.Annotation {
kotlin.annotation.target(allowedTargets = {AnnotationTarget.EXPRESSION}) kotlin.annotation.annotation() internal final annotation class ann : kotlin.Annotation {
public constructor ann()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,15 +1,15 @@
class A {
ann init {}
@ann init {}
<!UNRESOLVED_REFERENCE!>aaa<!> init {}
<!UNRESOLVED_REFERENCE!>@aaa<!> init {}
<!WRONG_ANNOTATION_TARGET!>ann<!> init {}
<!WRONG_ANNOTATION_TARGET!>@ann<!> init {}
<!UNRESOLVED_REFERENCE, WRONG_ANNOTATION_TARGET!>aaa<!> init {}
<!UNRESOLVED_REFERENCE, WRONG_ANNOTATION_TARGET!>@aaa<!> init {}
}
interface T {
<!ANONYMOUS_INITIALIZER_IN_TRAIT!>ann init {}<!>
<!ANONYMOUS_INITIALIZER_IN_TRAIT!>@ann init {}<!>
<!ANONYMOUS_INITIALIZER_IN_TRAIT!><!UNRESOLVED_REFERENCE!>aaa<!> init {}<!>
<!ANONYMOUS_INITIALIZER_IN_TRAIT!><!UNRESOLVED_REFERENCE!>@aaa<!> init {}<!>
<!ANONYMOUS_INITIALIZER_IN_TRAIT!><!WRONG_ANNOTATION_TARGET!>ann<!> init {}<!>
<!ANONYMOUS_INITIALIZER_IN_TRAIT!><!WRONG_ANNOTATION_TARGET!>@ann<!> init {}<!>
<!ANONYMOUS_INITIALIZER_IN_TRAIT!><!UNRESOLVED_REFERENCE, WRONG_ANNOTATION_TARGET!>aaa<!> init {}<!>
<!ANONYMOUS_INITIALIZER_IN_TRAIT!><!UNRESOLVED_REFERENCE, WRONG_ANNOTATION_TARGET!>@aaa<!> init {}<!>
}
annotation class ann
@@ -0,0 +1,16 @@
target(AnnotationTarget.PROPERTY_GETTER)
annotation class smartget
target(AnnotationTarget.PROPERTY_SETTER)
annotation class smartset
target(AnnotationTarget.FUNCTION)
annotation class base
class My(x: Int) {
<!WRONG_ANNOTATION_TARGET!>smartget<!> var y = x
<!WRONG_ANNOTATION_TARGET!>@base<!> @smartget <!WRONG_ANNOTATION_TARGET!>@smartset<!> get
<!WRONG_ANNOTATION_TARGET!>@base<!> <!WRONG_ANNOTATION_TARGET!>@smartget<!> @smartset set
base <!WRONG_ANNOTATION_TARGET!>smartget<!> <!WRONG_ANNOTATION_TARGET!>smartset<!> fun foo() = y
}
@@ -0,0 +1,31 @@
package
internal final class My {
public constructor My(/*0*/ x: kotlin.Int)
smartget() internal final var y: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
base() smartget() smartset() internal final fun foo(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.FUNCTION}) kotlin.annotation.annotation() internal final annotation class base : kotlin.Annotation {
public constructor base()
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
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.PROPERTY_GETTER}) kotlin.annotation.annotation() internal final annotation class smartget : kotlin.Annotation {
public constructor smartget()
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
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.PROPERTY_SETTER}) kotlin.annotation.annotation() internal final annotation class smartset : kotlin.Annotation {
public constructor smartset()
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
}
@@ -0,0 +1,20 @@
target(AnnotationTarget.ANNOTATION_CLASS) annotation class base
base annotation class derived
<!WRONG_ANNOTATION_TARGET!>base<!> class correct(<!WRONG_ANNOTATION_TARGET!>base<!> val x: Int) {
<!WRONG_ANNOTATION_TARGET!>base<!> constructor(): this(0)
}
<!WRONG_ANNOTATION_TARGET!>base<!> enum class My {
<!WRONG_ANNOTATION_TARGET!>@base<!> FIRST,
<!WRONG_ANNOTATION_TARGET!>@base<!> SECOND
}
<!WRONG_ANNOTATION_TARGET!>base<!> fun foo(<!WRONG_ANNOTATION_TARGET!>base<!> y: <!WRONG_ANNOTATION_TARGET!>@base<!> Int): Int {
<!WRONG_ANNOTATION_TARGET!>@base<!> fun bar(<!WRONG_ANNOTATION_TARGET!>base<!> z: <!WRONG_ANNOTATION_TARGET!>@base<!> Int) = z + 1
<!WRONG_ANNOTATION_TARGET!>@base<!> val local = bar(y)
return local
}
<!WRONG_ANNOTATION_TARGET!>base<!> val z = 0
@@ -0,0 +1,61 @@
package
base() internal val z: kotlin.Int = 0
base() internal fun foo(/*0*/ base() y: @[base()] kotlin.Int): kotlin.Int
base() internal final enum class My : kotlin.Enum<My> {
base() public enum entry FIRST : My {
private constructor FIRST()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
base() public enum entry SECOND : My {
private constructor SECOND()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
private constructor My()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): My
public final /*synthesized*/ fun values(): kotlin.Array<My>
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.ANNOTATION_CLASS}) kotlin.annotation.annotation() internal final annotation class base : kotlin.Annotation {
public constructor base()
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
}
base() internal final class correct {
base() public constructor correct()
public constructor correct(/*0*/ base() x: kotlin.Int)
base() internal final val x: 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
}
base() kotlin.annotation.annotation() internal final annotation class derived : kotlin.Annotation {
public constructor derived()
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
}
@@ -0,0 +1,21 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
target(AnnotationTarget.CLASSIFIER) annotation class base
base annotation class derived
base class correct(<!WRONG_ANNOTATION_TARGET!>base<!> val x: Int, <!WRONG_ANNOTATION_TARGET!>base<!> w: <!WRONG_ANNOTATION_TARGET!>@base<!> Int) {
<!WRONG_ANNOTATION_TARGET!>base<!> constructor(): this(0, 0)
}
base enum class My <!WRONG_ANNOTATION_TARGET!>@base<!> constructor() {
<!WRONG_ANNOTATION_TARGET!>@base<!> FIRST,
<!WRONG_ANNOTATION_TARGET!>@base<!> SECOND
}
<!WRONG_ANNOTATION_TARGET!>base<!> fun foo(<!WRONG_ANNOTATION_TARGET!>base<!> y: <!WRONG_ANNOTATION_TARGET!>@base<!> Int): Int {
<!WRONG_ANNOTATION_TARGET!>@base<!> fun bar(<!WRONG_ANNOTATION_TARGET!>base<!> z: <!WRONG_ANNOTATION_TARGET!>@base<!> Int) = z + 1
<!WRONG_ANNOTATION_TARGET!>@base<!> val local = bar(y)
return local
}
<!WRONG_ANNOTATION_TARGET!>base<!> val z = 0
@@ -0,0 +1,61 @@
package
base() internal val z: kotlin.Int = 0
base() internal fun foo(/*0*/ base() y: @[base()] kotlin.Int): kotlin.Int
base() internal final enum class My : kotlin.Enum<My> {
base() public enum entry FIRST : My {
private constructor FIRST()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
base() public enum entry SECOND : My {
private constructor SECOND()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
base() private constructor My()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): My
public final /*synthesized*/ fun values(): kotlin.Array<My>
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.CLASSIFIER}) kotlin.annotation.annotation() internal final annotation class base : kotlin.Annotation {
public constructor base()
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
}
base() internal final class correct {
base() public constructor correct()
public constructor correct(/*0*/ base() x: kotlin.Int, /*1*/ base() w: @[base()] kotlin.Int)
base() internal final val x: 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
}
base() kotlin.annotation.annotation() internal final annotation class derived : kotlin.Annotation {
public constructor derived()
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
}
@@ -0,0 +1,20 @@
target(AnnotationTarget.CONSTRUCTOR) annotation class base
<!WRONG_ANNOTATION_TARGET!>base<!> annotation class derived
<!WRONG_ANNOTATION_TARGET!>base<!> class correct(<!WRONG_ANNOTATION_TARGET!>base<!> val x: Int) {
base constructor(): this(0)
}
<!WRONG_ANNOTATION_TARGET!>base<!> enum class My @base constructor() {
<!WRONG_ANNOTATION_TARGET!>@base<!> FIRST,
<!WRONG_ANNOTATION_TARGET!>@base<!> SECOND
}
<!WRONG_ANNOTATION_TARGET!>base<!> fun foo(<!WRONG_ANNOTATION_TARGET!>base<!> y: <!WRONG_ANNOTATION_TARGET!>@base<!> Int): Int {
<!WRONG_ANNOTATION_TARGET!>@base<!> fun bar(<!WRONG_ANNOTATION_TARGET!>base<!> z: <!WRONG_ANNOTATION_TARGET!>@base<!> Int) = z + 1
<!WRONG_ANNOTATION_TARGET!>@base<!> val local = bar(y)
return local
}
<!WRONG_ANNOTATION_TARGET!>base<!> val z = 0
@@ -0,0 +1,61 @@
package
base() internal val z: kotlin.Int = 0
base() internal fun foo(/*0*/ base() y: @[base()] kotlin.Int): kotlin.Int
base() internal final enum class My : kotlin.Enum<My> {
base() public enum entry FIRST : My {
private constructor FIRST()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
base() public enum entry SECOND : My {
private constructor SECOND()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
base() private constructor My()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): My
public final /*synthesized*/ fun values(): kotlin.Array<My>
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.CONSTRUCTOR}) kotlin.annotation.annotation() internal final annotation class base : kotlin.Annotation {
public constructor base()
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
}
base() internal final class correct {
base() public constructor correct()
public constructor correct(/*0*/ base() x: kotlin.Int)
base() internal final val x: 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
}
base() kotlin.annotation.annotation() internal final annotation class derived : kotlin.Annotation {
public constructor derived()
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
}
@@ -0,0 +1,21 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
target() annotation class empty
<!WRONG_ANNOTATION_TARGET!>empty<!> annotation class derived
<!WRONG_ANNOTATION_TARGET!>empty<!> class correct(<!WRONG_ANNOTATION_TARGET!>empty<!> val x: Int, <!WRONG_ANNOTATION_TARGET!>empty<!> w: <!WRONG_ANNOTATION_TARGET!>@empty<!> Int) {
<!WRONG_ANNOTATION_TARGET!>empty<!> constructor(): this(0, 0)
}
<!WRONG_ANNOTATION_TARGET!>empty<!> enum class My <!WRONG_ANNOTATION_TARGET!>@empty<!> constructor() {
<!WRONG_ANNOTATION_TARGET!>@empty<!> FIRST,
<!WRONG_ANNOTATION_TARGET!>@empty<!> SECOND
}
<!WRONG_ANNOTATION_TARGET!>empty<!> fun foo(<!WRONG_ANNOTATION_TARGET!>empty<!> y: <!WRONG_ANNOTATION_TARGET!>@empty<!> Int): Int {
<!WRONG_ANNOTATION_TARGET!>@empty<!> fun bar(<!WRONG_ANNOTATION_TARGET!>empty<!> z: <!WRONG_ANNOTATION_TARGET!>@empty<!> Int) = z + 1
<!WRONG_ANNOTATION_TARGET!>@empty<!> val local = bar(y)
return local
}
<!WRONG_ANNOTATION_TARGET!>empty<!> val z = <!WRONG_ANNOTATION_TARGET!>@empty<!> 0
@@ -0,0 +1,61 @@
package
empty() internal val z: kotlin.Int
empty() internal fun foo(/*0*/ empty() y: @[empty()] kotlin.Int): kotlin.Int
empty() internal final enum class My : kotlin.Enum<My> {
empty() public enum entry FIRST : My {
private constructor FIRST()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
empty() public enum entry SECOND : My {
private constructor SECOND()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
empty() private constructor My()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): My
public final /*synthesized*/ fun values(): kotlin.Array<My>
}
empty() internal final class correct {
empty() public constructor correct()
public constructor correct(/*0*/ empty() x: kotlin.Int, /*1*/ empty() w: @[empty()] kotlin.Int)
empty() internal final val x: 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
}
empty() kotlin.annotation.annotation() internal final annotation class derived : kotlin.Annotation {
public constructor derived()
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
}
kotlin.annotation.target(allowedTargets = {}) kotlin.annotation.annotation() internal final annotation class empty : kotlin.Annotation {
public constructor empty()
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
}
@@ -0,0 +1,11 @@
annotation class base
target(AnnotationTarget.EXPRESSION) annotation class special
fun transform(i: Int, tr: (Int) -> Int): Int = <!WRONG_ANNOTATION_TARGET!>@base<!> @special tr(@special i)
base <!WRONG_ANNOTATION_TARGET!>special<!> fun foo(i: Int): Int {
val j = <!WRONG_ANNOTATION_TARGET!>@base<!> @special i + 1
if (j == 1) return foo(@special <!WRONG_ANNOTATION_TARGET!>@base<!> 42)
return transform(@special j, <!WRONG_ANNOTATION_TARGET!>@base<!> @special { @special it * 2 })
}
@@ -0,0 +1,18 @@
package
base() special() internal fun foo(/*0*/ i: kotlin.Int): kotlin.Int
internal fun transform(/*0*/ i: kotlin.Int, /*1*/ tr: (kotlin.Int) -> kotlin.Int): kotlin.Int
kotlin.annotation.annotation() internal final annotation class base : kotlin.Annotation {
public constructor base()
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
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.EXPRESSION}) kotlin.annotation.annotation() internal final annotation class special : kotlin.Annotation {
public constructor special()
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
}
@@ -0,0 +1,23 @@
// FILE: annotation.kt
package test
target(AnnotationTarget.FILE) annotation class special
annotation class common
// FILE: other.kt
@file:special
package test
<!WRONG_ANNOTATION_TARGET!>special<!> class Incorrect
// FILE: another.kt
<!WRONG_ANNOTATION_TARGET!>@file:common<!>
package test
common class Correct
@@ -0,0 +1,32 @@
package
package test {
test.common() internal final class Correct {
public constructor Correct()
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
}
test.special() internal final class Incorrect {
public constructor Incorrect()
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
}
kotlin.annotation.annotation() internal final annotation class common : kotlin.Annotation {
public constructor common()
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
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.FILE}) kotlin.annotation.annotation() internal final annotation class special : kotlin.Annotation {
public constructor special()
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
}
}
@@ -0,0 +1,22 @@
target(AnnotationTarget.FUNCTION) annotation class base
<!WRONG_ANNOTATION_TARGET!>base<!> annotation class derived
<!WRONG_ANNOTATION_TARGET!>base<!> class correct(<!WRONG_ANNOTATION_TARGET!>base<!> val x: Int) {
<!WRONG_ANNOTATION_TARGET!>base<!> constructor(): this(0)
base public fun baz() {}
}
<!WRONG_ANNOTATION_TARGET!>base<!> enum class My <!WRONG_ANNOTATION_TARGET!>@base<!> constructor() {
<!WRONG_ANNOTATION_TARGET!>@base<!> FIRST,
<!WRONG_ANNOTATION_TARGET!>@base<!> SECOND
}
base fun foo(<!WRONG_ANNOTATION_TARGET!>base<!> y: <!WRONG_ANNOTATION_TARGET!>@base<!> Int): Int {
@base fun bar(<!WRONG_ANNOTATION_TARGET!>base<!> z: <!WRONG_ANNOTATION_TARGET!>@base<!> Int) = z + 1
<!WRONG_ANNOTATION_TARGET!>@base<!> val local = bar(y)
return local
}
<!WRONG_ANNOTATION_TARGET!>base<!> val z = 0
@@ -0,0 +1,62 @@
package
base() internal val z: kotlin.Int = 0
base() internal fun foo(/*0*/ base() y: @[base()] kotlin.Int): kotlin.Int
base() internal final enum class My : kotlin.Enum<My> {
base() public enum entry FIRST : My {
private constructor FIRST()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
base() public enum entry SECOND : My {
private constructor SECOND()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
base() private constructor My()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): My
public final /*synthesized*/ fun values(): kotlin.Array<My>
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.FUNCTION}) kotlin.annotation.annotation() internal final annotation class base : kotlin.Annotation {
public constructor base()
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
}
base() internal final class correct {
base() public constructor correct()
public constructor correct(/*0*/ base() x: kotlin.Int)
base() internal final val x: kotlin.Int
base() public final fun baz(): kotlin.Unit
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
}
base() kotlin.annotation.annotation() internal final annotation class derived : kotlin.Annotation {
public constructor derived()
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
}
@@ -0,0 +1,13 @@
target(AnnotationTarget.EXPRESSION)
annotation class special
target(AnnotationTarget.TYPE)
annotation class base
fun transform(i: Int, tr: (@<!DEBUG_INFO_MISSING_UNRESOLVED!>special<!> Int) -> Int): Int = @special tr(@special i)
fun foo(i: Int): Int {
val j = @special i + 1
if (j == 1) return foo(@special 42)
return transform(@special j, @special { i: @base Int -> <!WRONG_ANNOTATION_TARGET!>@base<!> i * 2 })
}
@@ -0,0 +1,18 @@
package
internal fun foo(/*0*/ i: kotlin.Int): kotlin.Int
internal fun transform(/*0*/ i: kotlin.Int, /*1*/ tr: (kotlin.Int) -> kotlin.Int): kotlin.Int
kotlin.annotation.target(allowedTargets = {AnnotationTarget.TYPE}) kotlin.annotation.annotation() internal final annotation class base : kotlin.Annotation {
public constructor base()
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
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.EXPRESSION}) kotlin.annotation.annotation() internal final annotation class special : kotlin.Annotation {
public constructor special()
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
}
@@ -0,0 +1,21 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
target(AnnotationTarget.<!UNRESOLVED_REFERENCE!>INIT<!>) annotation class incorrect
<!WRONG_ANNOTATION_TARGET!>incorrect<!> annotation class derived
<!WRONG_ANNOTATION_TARGET!>incorrect<!> class correct(<!WRONG_ANNOTATION_TARGET!>incorrect<!> val x: Int, <!WRONG_ANNOTATION_TARGET!>incorrect<!> w: <!WRONG_ANNOTATION_TARGET!>@incorrect<!> Int) {
<!WRONG_ANNOTATION_TARGET!>incorrect<!> constructor(): this(0, 0)
}
<!WRONG_ANNOTATION_TARGET!>incorrect<!> enum class My <!WRONG_ANNOTATION_TARGET!>@incorrect<!> constructor() {
<!WRONG_ANNOTATION_TARGET!>@incorrect<!> FIRST,
<!WRONG_ANNOTATION_TARGET!>@incorrect<!> SECOND
}
<!WRONG_ANNOTATION_TARGET!>incorrect<!> fun foo(<!WRONG_ANNOTATION_TARGET!>incorrect<!> y: <!WRONG_ANNOTATION_TARGET!>@incorrect<!> Int): Int {
<!WRONG_ANNOTATION_TARGET!>@incorrect<!> fun bar(<!WRONG_ANNOTATION_TARGET!>incorrect<!> z: <!WRONG_ANNOTATION_TARGET!>@incorrect<!> Int) = z + 1
<!WRONG_ANNOTATION_TARGET!>@incorrect<!> val local = bar(y)
return local
}
<!WRONG_ANNOTATION_TARGET!>incorrect<!> val z = <!WRONG_ANNOTATION_TARGET!>@incorrect<!> 0
@@ -0,0 +1,61 @@
package
incorrect() internal val z: kotlin.Int
incorrect() internal fun foo(/*0*/ incorrect() y: @[incorrect()] kotlin.Int): kotlin.Int
incorrect() internal final enum class My : kotlin.Enum<My> {
incorrect() public enum entry FIRST : My {
private constructor FIRST()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
incorrect() public enum entry SECOND : My {
private constructor SECOND()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
incorrect() private constructor My()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): My
public final /*synthesized*/ fun values(): kotlin.Array<My>
}
incorrect() internal final class correct {
incorrect() public constructor correct()
public constructor correct(/*0*/ incorrect() x: kotlin.Int, /*1*/ incorrect() w: @[incorrect()] kotlin.Int)
incorrect() internal final val x: 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
}
incorrect() kotlin.annotation.annotation() internal final annotation class derived : kotlin.Annotation {
public constructor derived()
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
}
kotlin.annotation.target(allowedTargets = {}) kotlin.annotation.annotation() internal final annotation class incorrect : kotlin.Annotation {
public constructor incorrect()
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
}
@@ -0,0 +1,6 @@
annotation class base
base class My {
<!WRONG_ANNOTATION_TARGET!>@base<!> init {
}
}
@@ -0,0 +1,15 @@
package
base() internal final class My {
public constructor My()
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
}
kotlin.annotation.annotation() internal final annotation class base : kotlin.Annotation {
public constructor base()
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
}
@@ -0,0 +1,20 @@
target(AnnotationTarget.LOCAL_VARIABLE) annotation class base
<!WRONG_ANNOTATION_TARGET!>base<!> annotation class derived
<!WRONG_ANNOTATION_TARGET!>base<!> class correct(<!WRONG_ANNOTATION_TARGET!>base<!> val x: Int) {
<!WRONG_ANNOTATION_TARGET!>base<!> constructor(): this(0)
}
<!WRONG_ANNOTATION_TARGET!>base<!> enum class My {
<!WRONG_ANNOTATION_TARGET!>@base<!> FIRST,
<!WRONG_ANNOTATION_TARGET!>@base<!> SECOND
}
<!WRONG_ANNOTATION_TARGET!>base<!> fun foo(<!WRONG_ANNOTATION_TARGET!>base<!> y: <!WRONG_ANNOTATION_TARGET!>@base<!> Int): Int {
<!WRONG_ANNOTATION_TARGET!>@base<!> fun bar(<!WRONG_ANNOTATION_TARGET!>base<!> z: <!WRONG_ANNOTATION_TARGET!>@base<!> Int) = z + 1
@base val local = bar(y)
return local
}
<!WRONG_ANNOTATION_TARGET!>base<!> val z = 0
@@ -0,0 +1,61 @@
package
base() internal val z: kotlin.Int = 0
base() internal fun foo(/*0*/ base() y: @[base()] kotlin.Int): kotlin.Int
base() internal final enum class My : kotlin.Enum<My> {
base() public enum entry FIRST : My {
private constructor FIRST()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
base() public enum entry SECOND : My {
private constructor SECOND()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
private constructor My()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): My
public final /*synthesized*/ fun values(): kotlin.Array<My>
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.LOCAL_VARIABLE}) kotlin.annotation.annotation() internal final annotation class base : kotlin.Annotation {
public constructor base()
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
}
base() internal final class correct {
base() public constructor correct()
public constructor correct(/*0*/ base() x: kotlin.Int)
base() internal final val x: 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
}
base() kotlin.annotation.annotation() internal final annotation class derived : kotlin.Annotation {
public constructor derived()
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
}
@@ -0,0 +1,15 @@
target(AnnotationTarget.CLASSIFIER)
annotation class base
target(AnnotationTarget.ANNOTATION_CLASS)
annotation class meta
base class Outer {
base <!WRONG_ANNOTATION_TARGET!>meta<!> class Nested
base meta annotation class Annotated
fun foo() {
@base <!WRONG_ANNOTATION_TARGET!>@meta<!> class Local
}
}
@@ -0,0 +1,37 @@
package
base() internal final class Outer {
public constructor Outer()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
internal 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
base() meta() kotlin.annotation.annotation() internal final annotation class Annotated : kotlin.Annotation {
public constructor Annotated()
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
}
base() meta() internal final class Nested {
public constructor Nested()
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
}
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.CLASSIFIER}) kotlin.annotation.annotation() internal final annotation class base : kotlin.Annotation {
public constructor base()
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
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.ANNOTATION_CLASS}) kotlin.annotation.annotation() internal final annotation class meta : kotlin.Annotation {
public constructor meta()
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
}
@@ -0,0 +1,21 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
target(AnnotationTarget.PROPERTY) annotation class base
<!WRONG_ANNOTATION_TARGET!>base<!> annotation class derived
<!WRONG_ANNOTATION_TARGET!>base<!> class correct(base val x: Int, <!WRONG_ANNOTATION_TARGET!>base<!> w: Int) {
<!WRONG_ANNOTATION_TARGET!>base<!> constructor(): this(0, 0)
}
<!WRONG_ANNOTATION_TARGET!>base<!> enum class My {
@base FIRST,
@base SECOND
}
<!WRONG_ANNOTATION_TARGET!>base<!> fun foo(<!WRONG_ANNOTATION_TARGET!>base<!> y: <!WRONG_ANNOTATION_TARGET!>@base<!> Int): Int {
<!WRONG_ANNOTATION_TARGET!>@base<!> fun bar(<!WRONG_ANNOTATION_TARGET!>base<!> z: <!WRONG_ANNOTATION_TARGET!>@base<!> Int) = z + 1
<!WRONG_ANNOTATION_TARGET!>@base<!> val local = bar(y)
return local
}
base val z = 0
@@ -0,0 +1,61 @@
package
base() internal val z: kotlin.Int = 0
base() internal fun foo(/*0*/ base() y: @[base()] kotlin.Int): kotlin.Int
base() internal final enum class My : kotlin.Enum<My> {
base() public enum entry FIRST : My {
private constructor FIRST()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
base() public enum entry SECOND : My {
private constructor SECOND()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
private constructor My()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): My
public final /*synthesized*/ fun values(): kotlin.Array<My>
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.PROPERTY}) kotlin.annotation.annotation() internal final annotation class base : kotlin.Annotation {
public constructor base()
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
}
base() internal final class correct {
base() public constructor correct()
public constructor correct(/*0*/ base() x: kotlin.Int, /*1*/ base() w: kotlin.Int)
base() internal final val x: 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
}
base() kotlin.annotation.annotation() internal final annotation class derived : kotlin.Annotation {
public constructor derived()
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
}
@@ -0,0 +1,9 @@
annotation class base
target(AnnotationTarget.TYPE)
annotation class typed
base class My(val x: <!WRONG_ANNOTATION_TARGET!>@base<!> @typed Int, y: <!WRONG_ANNOTATION_TARGET!>@base<!> @typed Int) {
val z: <!WRONG_ANNOTATION_TARGET!>@base<!> @typed Int = y
fun foo(): <!WRONG_ANNOTATION_TARGET!>@base<!> @typed Int = z
}
@@ -0,0 +1,25 @@
package
base() internal final class My {
public constructor My(/*0*/ x: @[base() typed()] kotlin.Int, /*1*/ y: @[base() typed()] kotlin.Int)
internal final val x: @[base() typed()] kotlin.Int
internal final val z: @[base() typed()] kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
internal final fun foo(): @[base() typed()] kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
kotlin.annotation.annotation() internal final annotation class base : kotlin.Annotation {
public constructor base()
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
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.TYPE}) kotlin.annotation.annotation() internal final annotation class typed : kotlin.Annotation {
public constructor typed()
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
}
@@ -0,0 +1 @@
@file:suppress("abc")
@@ -0,0 +1 @@
package
@@ -0,0 +1,20 @@
target(AnnotationTarget.TYPE) annotation class base
<!WRONG_ANNOTATION_TARGET!>base<!> annotation class derived
<!WRONG_ANNOTATION_TARGET!>base<!> class correct(<!WRONG_ANNOTATION_TARGET!>base<!> val x: @base Int) {
<!WRONG_ANNOTATION_TARGET!>base<!> constructor(): this(0)
}
<!WRONG_ANNOTATION_TARGET!>base<!> enum class My <!WRONG_ANNOTATION_TARGET!>@base<!> constructor() {
<!WRONG_ANNOTATION_TARGET!>@base<!> FIRST,
<!WRONG_ANNOTATION_TARGET!>@base<!> SECOND
}
<!WRONG_ANNOTATION_TARGET!>base<!> fun foo(<!WRONG_ANNOTATION_TARGET!>base<!> y: @base Int): Int {
<!WRONG_ANNOTATION_TARGET!>@base<!> fun bar(<!WRONG_ANNOTATION_TARGET!>base<!> z: @base Int) = z + 1
<!WRONG_ANNOTATION_TARGET!>@base<!> val local = bar(y)
return local
}
<!WRONG_ANNOTATION_TARGET!>base<!> val z = 0
@@ -0,0 +1,61 @@
package
base() internal val z: kotlin.Int = 0
base() internal fun foo(/*0*/ base() y: @[base()] kotlin.Int): kotlin.Int
base() internal final enum class My : kotlin.Enum<My> {
base() public enum entry FIRST : My {
private constructor FIRST()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
base() public enum entry SECOND : My {
private constructor SECOND()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
base() private constructor My()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): My
public final /*synthesized*/ fun values(): kotlin.Array<My>
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.TYPE}) kotlin.annotation.annotation() internal final annotation class base : kotlin.Annotation {
public constructor base()
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
}
base() internal final class correct {
base() public constructor correct()
public constructor correct(/*0*/ base() x: @[base()] kotlin.Int)
base() internal final val x: @[base()] 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
}
base() kotlin.annotation.annotation() internal final annotation class derived : kotlin.Annotation {
public constructor derived()
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
}
@@ -0,0 +1,3 @@
annotation class base
val x: List<@<!DEBUG_INFO_MISSING_UNRESOLVED!>base<!> String>? = null
@@ -0,0 +1,10 @@
package
internal val x: kotlin.List<kotlin.String>? = null
kotlin.annotation.annotation() internal final annotation class base : kotlin.Annotation {
public constructor base()
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
}
@@ -0,0 +1,21 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
target(AnnotationTarget.VALUE_PARAMETER) annotation class base
<!WRONG_ANNOTATION_TARGET!>base<!> annotation class derived
<!WRONG_ANNOTATION_TARGET!>base<!> class correct(<!WRONG_ANNOTATION_TARGET!>base<!> val x: Int, base w: Int) {
<!WRONG_ANNOTATION_TARGET!>base<!> constructor(): this(0, 0)
}
<!WRONG_ANNOTATION_TARGET!>base<!> enum class My {
<!WRONG_ANNOTATION_TARGET!>@base<!> FIRST,
<!WRONG_ANNOTATION_TARGET!>@base<!> SECOND
}
<!WRONG_ANNOTATION_TARGET!>base<!> fun foo(base y: <!WRONG_ANNOTATION_TARGET!>@base<!> Int): Int {
<!WRONG_ANNOTATION_TARGET!>@base<!> fun bar(base z: <!WRONG_ANNOTATION_TARGET!>@base<!> Int) = z + 1
<!WRONG_ANNOTATION_TARGET!>@base<!> val local = bar(y)
return local
}
<!WRONG_ANNOTATION_TARGET!>base<!> val z = 0
@@ -0,0 +1,61 @@
package
base() internal val z: kotlin.Int = 0
base() internal fun foo(/*0*/ base() y: @[base()] kotlin.Int): kotlin.Int
base() internal final enum class My : kotlin.Enum<My> {
base() public enum entry FIRST : My {
private constructor FIRST()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
base() public enum entry SECOND : My {
private constructor SECOND()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
private constructor My()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: My): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): My
public final /*synthesized*/ fun values(): kotlin.Array<My>
}
kotlin.annotation.target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) kotlin.annotation.annotation() internal final annotation class base : kotlin.Annotation {
public constructor base()
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
}
base() internal final class correct {
base() public constructor correct()
public constructor correct(/*0*/ base() x: kotlin.Int, /*1*/ base() w: kotlin.Int)
base() internal final val x: 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
}
base() kotlin.annotation.annotation() internal final annotation class derived : kotlin.Annotation {
public constructor derived()
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
}
@@ -1,3 +1,4 @@
target(AnnotationTarget.EXPRESSION)
annotation class foo
fun f(s : String?) : Boolean {
@@ -2,7 +2,7 @@ package
internal fun f(/*0*/ s: kotlin.String?): kotlin.Boolean
kotlin.annotation.annotation() internal final annotation class foo : kotlin.Annotation {
kotlin.annotation.target(allowedTargets = {AnnotationTarget.EXPRESSION}) kotlin.annotation.annotation() internal final annotation class foo : kotlin.Annotation {
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
@@ -83,9 +83,9 @@ abstract class IllegalModifiers6() {
<!ILLEGAL_MODIFIER!>open<!> init {}
<!ILLEGAL_MODIFIER!>final<!> init {}
<!ILLEGAL_MODIFIER!>public<!> annotated init {}
<!ILLEGAL_MODIFIER!>public<!> <!WRONG_ANNOTATION_TARGET!>annotated<!> init {}
<!ILLEGAL_MODIFIER!>private<!> <!NOT_AN_ANNOTATION_CLASS!>IllegalModifiers6()<!> init {}
<!ILLEGAL_MODIFIER!>private<!> <!NOT_AN_ANNOTATION_CLASS, WRONG_ANNOTATION_TARGET!>IllegalModifiers6()<!> init {}
}
// strange inappropriate modifiers usages
@@ -97,7 +97,7 @@ abstract class IllegalModifiers6() {
class IllegalModifiers7() {
<!ILLEGAL_ENUM_ANNOTATION!>enum<!>
<!ILLEGAL_MODIFIER!>inner<!>
annotation
<!WRONG_ANNOTATION_TARGET!>annotation<!>
<!ILLEGAL_MODIFIER!>out<!>
<!ILLEGAL_MODIFIER!>in<!>
<!ILLEGAL_MODIFIER!>vararg<!>
@@ -105,7 +105,7 @@ class IllegalModifiers7() {
val x = 1
<!ILLEGAL_ENUM_ANNOTATION!>enum<!>
<!ILLEGAL_MODIFIER!>inner<!>
annotation
<!WRONG_ANNOTATION_TARGET!>annotation<!>
<!ILLEGAL_MODIFIER!>out<!>
<!ILLEGAL_MODIFIER!>in<!>
<!ILLEGAL_MODIFIER!>vararg<!>
@@ -119,7 +119,7 @@ class IllegalModifiers8 {
<!ILLEGAL_ENUM_ANNOTATION!>enum<!>
<!ILLEGAL_MODIFIER, REDUNDANT_MODIFIER, REDUNDANT_MODIFIER, INCOMPATIBLE_MODIFIERS!>open<!>
<!ILLEGAL_MODIFIER!>inner<!>
annotation
<!WRONG_ANNOTATION_TARGET!>annotation<!>
<!ILLEGAL_MODIFIER!>override<!>
<!ILLEGAL_MODIFIER!>out<!>
<!ILLEGAL_MODIFIER!>in<!>
@@ -143,7 +143,7 @@ class IllegalModifiers10
<!ILLEGAL_ENUM_ANNOTATION!>enum<!>
<!ILLEGAL_MODIFIER, REDUNDANT_MODIFIER, REDUNDANT_MODIFIER, INCOMPATIBLE_MODIFIERS!>open<!>
<!ILLEGAL_MODIFIER!>inner<!>
annotation
<!WRONG_ANNOTATION_TARGET!>annotation<!>
<!ILLEGAL_MODIFIER!>override<!>
<!ILLEGAL_MODIFIER!>out<!>
<!ILLEGAL_MODIFIER!>in<!>
@@ -1,5 +1,6 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
annotation class Ann
target(AnnotationTarget.EXPRESSION)
annotation(repeatable = true) class Ann
fun <T> bar(block: (T) -> Int) {}
@@ -3,7 +3,7 @@ package
internal fun </*0*/ T> bar(/*0*/ block: (T) -> kotlin.Int): kotlin.Unit
internal fun foo(): kotlin.Unit
kotlin.annotation.annotation() internal final annotation class Ann : kotlin.Annotation {
kotlin.annotation.target(allowedTargets = {AnnotationTarget.EXPRESSION}) kotlin.annotation.annotation(repeatable = true) internal final annotation class Ann : kotlin.Annotation {
public constructor Ann()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,5 +1,8 @@
// ALLOW_AST_ACCESS
package test
target(AnnotationTarget.TYPE)
annotation class A
class SimpleTypeAnnotation {
@@ -1,6 +1,6 @@
package test
kotlin.annotation.annotation() internal final annotation class A : kotlin.Annotation {
kotlin.annotation.target(allowedTargets = {AnnotationTarget.TYPE}) kotlin.annotation.annotation() internal final annotation class A : kotlin.Annotation {
/*primary*/ public constructor A()
}
@@ -2,6 +2,7 @@
package test
target(AnnotationTarget.TYPE)
annotation class Ann(val x: String, val y: Double)
class TypeAnnotationWithArguments {
@@ -1,6 +1,6 @@
package test
kotlin.annotation.annotation() internal final annotation class Ann : kotlin.Annotation {
kotlin.annotation.target(allowedTargets = {AnnotationTarget.TYPE}) kotlin.annotation.annotation() internal final annotation class Ann : kotlin.Annotation {
/*primary*/ public constructor Ann(/*0*/ x: kotlin.String, /*1*/ y: kotlin.Double)
internal final val x: kotlin.String
internal final fun <get-x>(): kotlin.String
@@ -1033,6 +1033,129 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/target.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/diagnostics/tests/annotations/options/targets")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Targets extends AbstractJetDiagnosticsTest {
@TestMetadata("accessors.kt")
public void testAccessors() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/accessors.kt");
doTest(fileName);
}
public void testAllFilesPresentInTargets() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/annotations/options/targets"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("annotation.kt")
public void testAnnotation() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/annotation.kt");
doTest(fileName);
}
@TestMetadata("classifier.kt")
public void testClassifier() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/classifier.kt");
doTest(fileName);
}
@TestMetadata("constructor.kt")
public void testConstructor() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/constructor.kt");
doTest(fileName);
}
@TestMetadata("empty.kt")
public void testEmpty() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/empty.kt");
doTest(fileName);
}
@TestMetadata("expr.kt")
public void testExpr() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/expr.kt");
doTest(fileName);
}
@TestMetadata("file.kt")
public void testFile() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/file.kt");
doTest(fileName);
}
@TestMetadata("function.kt")
public void testFunction() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/function.kt");
doTest(fileName);
}
@TestMetadata("funtypeargs.kt")
public void testFuntypeargs() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/funtypeargs.kt");
doTest(fileName);
}
@TestMetadata("incorrect.kt")
public void testIncorrect() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/incorrect.kt");
doTest(fileName);
}
@TestMetadata("init.kt")
public void testInit() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/init.kt");
doTest(fileName);
}
@TestMetadata("local.kt")
public void testLocal() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/local.kt");
doTest(fileName);
}
@TestMetadata("nested.kt")
public void testNested() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/nested.kt");
doTest(fileName);
}
@TestMetadata("property.kt")
public void testProperty() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/property.kt");
doTest(fileName);
}
@TestMetadata("returntype.kt")
public void testReturntype() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/returntype.kt");
doTest(fileName);
}
@TestMetadata("suppress.kt")
public void testSuppress() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/suppress.kt");
doTest(fileName);
}
@TestMetadata("type.kt")
public void testType() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/type.kt");
doTest(fileName);
}
@TestMetadata("typeargs.kt")
public void testTypeargs() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/typeargs.kt");
doTest(fileName);
}
@TestMetadata("valueparam.kt")
public void testValueparam() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/targets/valueparam.kt");
doTest(fileName);
}
}
}
}
+3 -2
View File
@@ -1,8 +1,8 @@
@file:kotlin.deprecated("message")
<error>@file:kotlin.deprecated("message")</error>
@file:suppress(<error>BAR</error>)
@file:suppress(BAZ)
@<error>k</error>otlin.deprecated("message")
<error>@<error>k</error>otlin.deprecated("message")</error>
@<error>s</error>uppress(<error>BAR</error>)
@<error>s</error>uppress(BAZ)
@@ -19,4 +19,5 @@ package boo
val BAZ = "baz"
val N = 0
target(AnnotationTarget.FILE)
annotation class myAnnotation(val i: Int, val s: String)
@@ -1,5 +1,13 @@
package dependency
target(AnnotationTarget.CLASSIFIER, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY,
AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.TYPE)
annotation class A(val s: String)
target(AnnotationTarget.CLASSIFIER, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY,
AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.TYPE)
annotation class B(val i: Int)
target(AnnotationTarget.CLASSIFIER, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY,
AnnotationTarget.VALUE_PARAMETER)
annotation class C
@@ -25,8 +25,13 @@ a public class Annotations private @a constructor(private @a val c1: Int, @a val
fun types(param: @a @b(E.E1) DoubleRange): @a @b(E.E2) Unit {}
}
target(AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FUNCTION,
AnnotationTarget.CONSTRUCTOR, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.TYPE, AnnotationTarget.CLASSIFIER)
annotation class a
annotation class b(val e: E)
target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.CLASSIFIER,
AnnotationTarget.CONSTRUCTOR, AnnotationTarget.TYPE)
annotation(repeatable = false) class b(val e: E)
enum class E { E1 E2 }
+1
View File
@@ -1,3 +1,4 @@
<info descr="null" textAttributesKey="KOTLIN_ANNOTATION">target</info>(<info descr="null" textAttributesKey="KOTLIN_CLASS">AnnotationTarget</info>.<info descr="null" textAttributesKey="KOTLIN_ENUM_ENTRY">CLASSIFIER</info>, <info descr="null" textAttributesKey="KOTLIN_CLASS">AnnotationTarget</info>.<info descr="null" textAttributesKey="KOTLIN_ENUM_ENTRY">EXPRESSION</info>)
<info descr="null">annotation</info> class <info descr="null">Ann</info>
<info descr="null" textAttributesKey="KOTLIN_ANNOTATION">Ann</info> class <info descr="null">A1</info>
@@ -1,3 +1,4 @@
target(AnnotationTarget.EXPRESSION)
annotation class ann
fun foo(): Int = <caret>@ann 1
@@ -1,3 +1,4 @@
target(AnnotationTarget.EXPRESSION)
annotation class ann
fun foo(): Int {
@@ -4,4 +4,5 @@ fun foo() {
@ann ""<caret>!!
}
target(AnnotationTarget.EXPRESSION)
annotation class ann
@@ -5,4 +5,5 @@ fun foo() {
@ann ""<caret>!!
}
target(AnnotationTarget.EXPRESSION)
annotation class ann