Targeting / retention for a set of standard annotations, some inapplicable annotation checks replaced with target check, some fixed tests

This commit is contained in:
Mikhail Glukhikh
2015-07-16 11:35:28 +03:00
parent a75daf85e2
commit 94a00540be
53 changed files with 213 additions and 206 deletions
@@ -96,10 +96,6 @@ public class PlatformStaticAnnotationChecker : DeclarationChecker {
if (declaration is JetNamedFunction || declaration is JetProperty || declaration is JetPropertyAccessor) {
checkDeclaration(declaration, descriptor, diagnosticHolder)
}
else {
//TODO: there should be general mechanism
diagnosticHolder.report(ErrorsJvm.PLATFORM_STATIC_ILLEGAL_USAGE.on(declaration, descriptor));
}
}
}
@@ -172,10 +168,8 @@ public class PublicFieldAnnotationChecker: DeclarationChecker {
diagnosticHolder.report(ErrorsJvm.INAPPLICABLE_PUBLIC_FIELD.on(annotationEntry))
}
if (descriptor !is PropertyDescriptor) {
report()
}
else if (!bindingContext.get<PropertyDescriptor, Boolean>(BindingContext.BACKING_FIELD_REQUIRED, descriptor)!!) {
if (descriptor is PropertyDescriptor
&& !bindingContext.get<PropertyDescriptor, Boolean>(BindingContext.BACKING_FIELD_REQUIRED, descriptor)!!) {
report()
}
}
@@ -58,10 +58,7 @@ public class NativeFunChecker : DeclarationChecker {
diagnosticHolder.report(ErrorsJvm.NATIVE_DECLARATION_CANNOT_BE_ABSTRACT.on(declaration))
}
if (descriptor is ConstructorDescriptor) {
diagnosticHolder.report(Errors.INAPPLICABLE_ANNOTATION.on(declaration));
}
else if (declaration is JetDeclarationWithBody && declaration.hasBody()) {
if (descriptor !is ConstructorDescriptor && declaration is JetDeclarationWithBody && declaration.hasBody()) {
diagnosticHolder.report(ErrorsJvm.NATIVE_DECLARATION_CANNOT_HAVE_BODY.on(declaration))
}
@@ -47,7 +47,6 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
MAP.put(ErrorsJvm.ACCIDENTAL_OVERRIDE, "Accidental override: {0}", CONFLICTING_JVM_DECLARATIONS_DATA);
MAP.put(ErrorsJvm.PLATFORM_STATIC_NOT_IN_OBJECT, "Only functions in named objects and companion objects of classes can be annotated with 'platformStatic'");
MAP.put(ErrorsJvm.OVERRIDE_CANNOT_BE_STATIC, "Override member cannot be 'platformStatic' in object");
MAP.put(ErrorsJvm.PLATFORM_STATIC_ILLEGAL_USAGE, "This declaration does not support ''platformStatic''", DescriptorRenderer.SHORT_NAMES_IN_TYPES);
MAP.put(ErrorsJvm.OVERLOADS_WITHOUT_DEFAULT_ARGUMENTS, "''jvmOverloads'' annotation has no effect for methods without default arguments");
MAP.put(ErrorsJvm.OVERLOADS_ABSTRACT, "''jvmOverloads'' annotation cannot be used on abstract methods");
MAP.put(ErrorsJvm.OVERLOADS_PRIVATE, "''jvmOverloads'' annotation has no effect on private and local declarations");
@@ -43,7 +43,6 @@ public interface ErrorsJvm {
DiagnosticFactory0<JetDeclaration> OVERRIDE_CANNOT_BE_STATIC = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
DiagnosticFactory0<JetDeclaration> PLATFORM_STATIC_NOT_IN_OBJECT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
DiagnosticFactory1<JetDeclaration, DeclarationDescriptor> PLATFORM_STATIC_ILLEGAL_USAGE = DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE);
DiagnosticFactory0<JetDeclaration> OVERLOADS_WITHOUT_DEFAULT_ARGUMENTS = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE);
DiagnosticFactory0<JetDeclaration> OVERLOADS_ABSTRACT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
@@ -112,7 +112,6 @@ public interface Errors {
DiagnosticFactory1<PsiElement, JetModifierKeywordToken> ILLEGAL_MODIFIER = DiagnosticFactory1.create(ERROR);
DiagnosticFactory1<PsiElement, JetModifierKeywordToken> REPEATED_MODIFIER = DiagnosticFactory1.create(ERROR);
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);
@@ -135,7 +135,6 @@ public class DefaultErrorMessages {
});
MAP.put(ILLEGAL_MODIFIER, "Illegal modifier ''{0}''", TO_STRING);
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);
@@ -299,7 +299,7 @@ public class ModifiersChecker {
JetAnnotationEntry annotationEntry = trace.get(BindingContext.ANNOTATION_DESCRIPTOR_TO_PSI_ELEMENT, annotation);
if (annotationEntry == null) return;
if (!isRenamableDeclaration(descriptor)) {
if (descriptor instanceof FunctionDescriptor && !isRenamableFunction((FunctionDescriptor) descriptor)) {
trace.report(INAPPLICABLE_PLATFORM_NAME.on(annotationEntry));
}
@@ -324,12 +324,10 @@ public class ModifiersChecker {
}
private static boolean isRenamableDeclaration(@NotNull DeclarationDescriptor descriptor) {
private static boolean isRenamableFunction(@NotNull FunctionDescriptor descriptor) {
DeclarationDescriptor containingDescriptor = descriptor.getContainingDeclaration();
return (descriptor instanceof PropertyAccessorDescriptor)
|| (containingDescriptor instanceof PackageFragmentDescriptor || containingDescriptor instanceof ClassDescriptor)
&& descriptor instanceof FunctionDescriptor && !(descriptor instanceof ConstructorDescriptor);
return containingDescriptor instanceof PackageFragmentDescriptor || containingDescriptor instanceof ClassDescriptor;
}
private void checkCompatibility(@Nullable JetModifierList modifierList, Collection<JetModifierKeywordToken> availableModifiers, Collection<JetModifierKeywordToken>... availableCombinations) {
+3 -3
View File
@@ -1277,19 +1277,19 @@ kotlin.annotation.target(allowedTargets = {AnnotationTarget.TYPE}) kotlin.annota
/*primary*/ public constructor extension()
}
kotlin.annotation.annotation() public final class inline : kotlin.Annotation {
kotlin.annotation.target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY}) kotlin.annotation.annotation(retention = AnnotationRetention.RUNTIME) public final class inline : kotlin.Annotation {
/*primary*/ public constructor inline(/*0*/ strategy: kotlin.InlineStrategy = ...)
public final val strategy: kotlin.InlineStrategy
public final fun <get-strategy>(): kotlin.InlineStrategy
}
kotlin.annotation.annotation() public final class inlineOptions : kotlin.Annotation {
kotlin.annotation.target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) kotlin.annotation.annotation(retention = AnnotationRetention.RUNTIME) public final class inlineOptions : kotlin.Annotation {
/*primary*/ public constructor inlineOptions(/*0*/ vararg value: kotlin.InlineOption /*kotlin.Array<out kotlin.InlineOption>*/)
internal final val value: kotlin.Array<out kotlin.InlineOption>
internal final fun <get-value>(): kotlin.Array<out kotlin.InlineOption>
}
kotlin.annotation.annotation() public final class noinline : kotlin.Annotation {
kotlin.annotation.target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) kotlin.annotation.annotation(retention = AnnotationRetention.RUNTIME) public final class noinline : kotlin.Annotation {
/*primary*/ public constructor noinline()
}
@@ -15,8 +15,8 @@ fun foo() {
@native
class B {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeGetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
val foo = 0
}
@native
@@ -13,8 +13,8 @@ fun foo() {
}
class B {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeGetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
val foo = 0
}
class C {
@@ -4,9 +4,9 @@ fun foo() {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeGetter
fun toplevelFun(): <!NATIVE_GETTER_RETURN_TYPE_SHOULD_BE_NULLABLE!>Any<!><!> = 0
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
val toplevelVal<!> = 0
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
val toplevelVal = 0
@nativeGetter
class <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>Foo<!> {}
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
class Foo {}
}
@@ -25,18 +25,18 @@ class A {
native
class B {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeGetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
val foo = 0
nativeGetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj1<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
object Obj1 {}
companion object {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeGetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
val foo = 0
nativeGetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj2<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
object Obj2 {}
}
}
@@ -26,18 +26,18 @@ class A {
}
class B {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeGetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
val foo = 0
nativeGetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj1<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
object Obj1 {}
companion object {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeGetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
val foo = 0
nativeGetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj2<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
object Obj2 {}
}
}
@@ -34,18 +34,18 @@ class A {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeGetter
fun Int.get3(a: Int): String?<!> = "OK"
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeGetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
val foo = 0
nativeGetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj1<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
object Obj1 {}
companion object {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeGetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
val foo = 0
nativeGetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj2<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
object Obj2 {}
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeGetter
fun Int.get(a: String): Int?<!> = 1
@@ -23,18 +23,18 @@ class A {
}
class B {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeGetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
val foo = 0
nativeGetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj1<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
object Obj1 {}
companion object {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeGetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
val foo = 0
nativeGetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj2<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
object Obj2 {}
}
}
@@ -3,8 +3,8 @@
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>nativeGetter
fun toplevelFun(): <!NATIVE_GETTER_RETURN_TYPE_SHOULD_BE_NULLABLE!>Any<!><!> = 0
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeGetter
val toplevelVal<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
val toplevelVal = 0
nativeGetter
class <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>Foo<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeGetter<!>
class Foo {}
@@ -4,9 +4,9 @@ fun foo() {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
fun toplevelFun()<!> {}
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
val toplevelVal<!> = 0
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
val toplevelVal = 0
@nativeInvoke
class <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>Foo<!> {}
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
class Foo {}
}
@@ -14,11 +14,11 @@ class A {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeInvoke
fun Int.invoke(a: String, b: Int)<!> = "OK"
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeInvoke
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeInvoke<!>
val foo = 0
nativeInvoke
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj1<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeInvoke<!>
object Obj1 {}
companion object {
nativeInvoke
@@ -33,10 +33,10 @@ class A {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeInvoke
fun Int.invoke(a: String, b: Int)<!> = "OK"
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeInvoke
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeInvoke<!>
val foo = 0
nativeInvoke
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj2<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeInvoke<!>
object Obj2 {}
}
}
@@ -13,11 +13,11 @@ class A {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeInvoke
fun Int.invoke(a: String, b: Int)<!> = "OK"
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeInvoke
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeInvoke<!>
val foo = 0
nativeInvoke
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeInvoke<!>
object Obj {}
companion object {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeInvoke
@@ -3,8 +3,8 @@
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeInvoke
fun toplevelFun()<!> {}
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeInvoke
val toplevelVal<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeInvoke<!>
val toplevelVal = 0
nativeInvoke
class <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>Foo<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeInvoke<!>
class Foo {}
@@ -21,8 +21,8 @@ fun foo() {
@native
class B {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeSetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
val foo = 0
}
@native
@@ -13,8 +13,8 @@ fun foo() {
}
class B {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeSetter
var foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
var foo = 0
}
class C {
@@ -4,9 +4,9 @@ fun foo() {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
fun toplevelFun(): Any<!> = 0
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
val toplevelVal<!> = 0
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
val toplevelVal = 0
@nativeSetter
class <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>Foo<!> {}
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
class Foo {}
}
@@ -37,18 +37,18 @@ class A {
native
class B {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeSetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
val foo = 0
nativeSetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj1<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
object Obj1 {}
companion object {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeSetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
val foo = 0
nativeSetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj2<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
object Obj2 {}
}
}
@@ -38,18 +38,18 @@ class A {
}
class B {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeSetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
val foo = 0
nativeSetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj1<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
object Obj1 {}
companion object {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeSetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
val foo = 0
nativeSetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj2<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
object Obj2 {}
}
}
@@ -31,18 +31,18 @@ class A {
}
class B {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeSetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
val foo = 0
nativeSetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj1<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
object Obj1 {}
companion object {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeSetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
val foo = 0
nativeSetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj2<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
object Obj2 {}
}
}
@@ -23,18 +23,18 @@ class A {
}
class B {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeSetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
val foo = 0
nativeSetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj1<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
object Obj1 {}
companion object {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeSetter
val foo<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
val foo = 0
nativeSetter
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>object Obj2<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
object Obj2 {}
}
}
@@ -3,8 +3,8 @@
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>nativeSetter
fun toplevelFun(): Any<!> = 0
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeSetter
val toplevelVal<!> = 0
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
val toplevelVal = 0
nativeSetter
class <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>Foo<!> {}
<!WRONG_ANNOTATION_TARGET!>nativeSetter<!>
class Foo {}
@@ -8,10 +8,10 @@ fun foo() {}
@platformName("b")
fun Any.foo() {}
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("c")<!>
<!WRONG_ANNOTATION_TARGET!>@platformName("c")<!>
val px = 1
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("d")<!>
<!WRONG_ANNOTATION_TARGET!>@platformName("d")<!>
val Any.px : Int
get() = 1
@@ -31,9 +31,9 @@ var vardef: Int = 1
@platformName("i")
set
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("C")<!>
class C <!INAPPLICABLE_PLATFORM_NAME!>platformName("primary")<!> constructor() {
<!INAPPLICABLE_PLATFORM_NAME!>platformName("ctr")<!> constructor(x: Int): this() {}
<!WRONG_ANNOTATION_TARGET!>@platformName("C")<!>
class C <!WRONG_ANNOTATION_TARGET!>platformName("primary")<!> constructor() {
<!WRONG_ANNOTATION_TARGET!>platformName("ctr")<!> constructor(x: Int): this() {}
@platformName("a")
fun foo() {}
@@ -41,10 +41,10 @@ class C <!INAPPLICABLE_PLATFORM_NAME!>platformName("primary")<!> constructor() {
@platformName("b")
fun Any.foo() {}
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("c")<!>
<!WRONG_ANNOTATION_TARGET!>@platformName("c")<!>
val px = 1
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("d")<!>
<!WRONG_ANNOTATION_TARGET!>@platformName("d")<!>
val Any.px : Int
get() = 1
@@ -63,7 +63,7 @@ fun foo1() {
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("a")<!>
fun foo() {}
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("a")<!>
<!WRONG_ANNOTATION_TARGET!>@platformName("a")<!>
val x = 1
}
@@ -1,9 +1,9 @@
import kotlin.platform.platformStatic
class A {
platformStatic <!PLATFORM_STATIC_ILLEGAL_USAGE!>constructor()<!> {}
<!WRONG_ANNOTATION_TARGET!>platformStatic<!> constructor() {}
inner class B {
platformStatic <!PLATFORM_STATIC_ILLEGAL_USAGE!>constructor()<!> {}
<!WRONG_ANNOTATION_TARGET!>platformStatic<!> constructor() {}
}
}
class C platformStatic <!PLATFORM_STATIC_ILLEGAL_USAGE!>constructor()<!>
class C <!WRONG_ANNOTATION_TARGET!>platformStatic<!> constructor()
@@ -1,16 +1,16 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class C {
<!INAPPLICABLE_PUBLIC_FIELD!>@kotlin.jvm.publicField<!> constructor(s: String) {
<!WRONG_ANNOTATION_TARGET!>@kotlin.jvm.publicField<!> constructor(s: String) {
}
<!INAPPLICABLE_PUBLIC_FIELD!>@kotlin.jvm.publicField<!> private fun foo(s: String = "OK") {
<!WRONG_ANNOTATION_TARGET!>@kotlin.jvm.publicField<!> private fun foo(s: String = "OK") {
}
}
<!INAPPLICABLE_PUBLIC_FIELD!>@kotlin.jvm.publicField<!>
<!WRONG_ANNOTATION_TARGET!>@kotlin.jvm.publicField<!>
fun foo() {
<!INAPPLICABLE_PUBLIC_FIELD!>@kotlin.jvm.publicField<!> val <!UNUSED_VARIABLE!>x<!> = "A"
<!WRONG_ANNOTATION_TARGET!>@kotlin.jvm.publicField<!> val <!UNUSED_VARIABLE!>x<!> = "A"
}
@@ -1,10 +1,10 @@
class A {
<!INAPPLICABLE_ANNOTATION!>native constructor() {}<!>
<!WRONG_ANNOTATION_TARGET!>native<!> constructor() {}
inner class B {
<!INAPPLICABLE_ANNOTATION!>native constructor() {}<!>
<!WRONG_ANNOTATION_TARGET!>native<!> constructor() {}
}
<!INAPPLICABLE_ANNOTATION!>native constructor(<!UNUSED_PARAMETER!>x<!>: Int)
<!>}
<!WRONG_ANNOTATION_TARGET!>native<!> constructor(<!UNUSED_PARAMETER!>x<!>: Int)
}
class C <!INAPPLICABLE_ANNOTATION!>native constructor()<!>
class C <!WRONG_ANNOTATION_TARGET!>native<!> constructor()