Check annotations on type arguments
This commit is contained in:
@@ -42,6 +42,9 @@ public class AnnotationChecker(private val additionalCheckers: Iterable<Addition
|
|||||||
annotated.typeReference?.let { check(it, trace) }
|
annotated.typeReference?.let { check(it, trace) }
|
||||||
annotated.receiverTypeReference?.let { check(it, trace) }
|
annotated.receiverTypeReference?.let { check(it, trace) }
|
||||||
}
|
}
|
||||||
|
if (annotated is JetTypeReference) {
|
||||||
|
annotated.typeElement?.typeArgumentsAsTypes?.filterNotNull()?.forEach { check(it, trace) }
|
||||||
|
}
|
||||||
if (annotated is JetDeclarationWithBody) {
|
if (annotated is JetDeclarationWithBody) {
|
||||||
// JetFunction or JetPropertyAccessor
|
// JetFunction or JetPropertyAccessor
|
||||||
for (parameter in annotated.valueParameters) {
|
for (parameter in annotated.valueParameters) {
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ val baz2: @[a b(1)] Int? = 1
|
|||||||
|
|
||||||
fun foo3(i: <!WRONG_ANNOTATION_TARGET!>@c<!> Int?) {}
|
fun foo3(i: <!WRONG_ANNOTATION_TARGET!>@c<!> Int?) {}
|
||||||
|
|
||||||
fun foo3(l: List<@c Int?>) {}
|
fun foo3(l: List<<!WRONG_ANNOTATION_TARGET!>@c<!> Int?>) {}
|
||||||
|
|
||||||
fun <!WRONG_ANNOTATION_TARGET!>@c<!> Int?.bar3() {}
|
fun <!WRONG_ANNOTATION_TARGET!>@c<!> Int?.bar3() {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// This test checks that annotations on extension function types are preserved. See the corresponding .txt file
|
// This test checks that annotations on extension function types are preserved. See the corresponding .txt file
|
||||||
|
|
||||||
|
@Target(AnnotationTarget.TYPE)
|
||||||
annotation class ann
|
annotation class ann
|
||||||
|
|
||||||
interface Some {
|
interface Some {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public interface Some {
|
|||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
|
|
||||||
@kotlin.annotation.annotation() public final class ann : kotlin.Annotation {
|
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) @kotlin.annotation.annotation() public final class ann : kotlin.Annotation {
|
||||||
public constructor ann()
|
public constructor ann()
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
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 hashCode(): kotlin.Int
|
||||||
|
|||||||
+7
-2
@@ -1,5 +1,10 @@
|
|||||||
annotation class base
|
annotation class base
|
||||||
|
|
||||||
val x: List<@base String>? = null
|
val x: List<<!WRONG_ANNOTATION_TARGET!>@base<!> String>? = null
|
||||||
|
|
||||||
val y: List<@[base] String>? = null
|
val y: List<@[<!WRONG_ANNOTATION_TARGET!>base<!>] String>? = null
|
||||||
|
|
||||||
|
@Target(AnnotationTarget.TYPE)
|
||||||
|
annotation class typeAnn
|
||||||
|
|
||||||
|
fun foo(list: List<@typeAnn Int>) = list
|
||||||
@@ -2,6 +2,7 @@ package
|
|||||||
|
|
||||||
public val x: kotlin.List<@base() kotlin.String>? = null
|
public val x: kotlin.List<@base() kotlin.String>? = null
|
||||||
public val y: kotlin.List<@base() kotlin.String>? = null
|
public val y: kotlin.List<@base() kotlin.String>? = null
|
||||||
|
public fun foo(/*0*/ list: kotlin.List<@typeAnn() kotlin.Int>): kotlin.List<@typeAnn() kotlin.Int>
|
||||||
|
|
||||||
@kotlin.annotation.annotation() public final class base : kotlin.Annotation {
|
@kotlin.annotation.annotation() public final class base : kotlin.Annotation {
|
||||||
public constructor base()
|
public constructor base()
|
||||||
@@ -9,3 +10,10 @@ public val y: kotlin.List<@base() kotlin.String>? = null
|
|||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) @kotlin.annotation.annotation() public final class typeAnn : kotlin.Annotation {
|
||||||
|
public constructor typeAnn()
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user