FIR: fix OPT_IN_MARKER_ON_WRONG_TARGET for constructor properties

This commit is contained in:
Mikhail Glukhikh
2021-09-23 19:09:48 +03:00
committed by TeamCityServer
parent e9bff861dd
commit 212c3e8d51
3 changed files with 12 additions and 1 deletions
@@ -29,7 +29,8 @@ object FirOptInMarkedDeclarationChecker : FirAnnotatedDeclarationChecker() {
reporter.reportOn(annotation.source, FirErrors.OPT_IN_MARKER_ON_WRONG_TARGET, "getter", context)
}
if (useSiteTarget == SETTER_PARAMETER ||
declaration is FirValueParameter && KotlinTarget.VALUE_PARAMETER in annotationClass.getAllowedAnnotationTargets()
(useSiteTarget != PROPERTY && declaration is FirValueParameter &&
KotlinTarget.VALUE_PARAMETER in annotationClass.getAllowedAnnotationTargets())
) {
reporter.reportOn(annotation.source, FirErrors.OPT_IN_MARKER_ON_WRONG_TARGET, "parameter", context)
}
@@ -85,6 +85,8 @@ class Derived : Base {
override fun <!OPT_IN_MARKER_ON_WRONG_TARGET!>@receiver:E6<!> String.withReceiver() {}
}
class Wrapper(@property:E6 val foo: Int)
@E6
interface BaseMarked {
val bar: Int
@@ -159,6 +159,14 @@ package api {
}
}
public final class Wrapper {
public constructor Wrapper(/*0*/ foo: kotlin.Int)
@api.E6 public final val foo: 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
}
public final class X1 : api.C1 {
public constructor X1()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean