[FIR-TEST] Add new testdata generated after changes in previous commit
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
class Annotation(val x: Int) {
|
||||
fun baz() {}
|
||||
fun bar() = x
|
||||
}
|
||||
|
||||
fun foo(annotation: Annotation): Int {
|
||||
if (annotation.bar() == 0) {
|
||||
annotation.baz()
|
||||
return 0
|
||||
}
|
||||
else {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
class Annotation {
|
||||
fun setProblemGroup() {}
|
||||
fun getQuickFixes() = 0
|
||||
}
|
||||
|
||||
fun registerQuickFix(annotation: Annotation) {
|
||||
annotation.setProblemGroup()
|
||||
val fixes = annotation.getQuickFixes()
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class ExprAnn
|
||||
|
||||
fun foo(): Int {
|
||||
var a: Int
|
||||
@ExprAnn a = 1
|
||||
@ExprAnn a += 1
|
||||
return a
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
@MustBeDocumented
|
||||
annotation class DocAnn
|
||||
|
||||
annotation class NotDocAnn
|
||||
|
||||
@DocAnn class My
|
||||
|
||||
@NotDocAnn class Your
|
||||
@@ -0,0 +1,10 @@
|
||||
// See KT-9145
|
||||
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class Ann
|
||||
|
||||
fun foo() {
|
||||
for (@Ann private x in 1..100) {
|
||||
if (x == 1) return
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class ExprAnn
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
annotation class FunAnn
|
||||
|
||||
fun foo(): Int {
|
||||
val x = @ExprAnn fun() = 1
|
||||
val y = @FunAnn fun() = 2
|
||||
return x() + y()
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
annotation class FunAnn
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class SourceAnn
|
||||
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class ExprAnn
|
||||
|
||||
fun bar(arg: () -> Int) = arg()
|
||||
|
||||
inline fun fast(arg: () -> Int) = arg()
|
||||
|
||||
inline fun fast2(x: Int, arg: () -> Int) = x + arg()
|
||||
|
||||
@FunAnn fun gav() = 13
|
||||
|
||||
fun foo(arg: Int) {
|
||||
// Literal is annotatable
|
||||
bar @FunAnn { arg }
|
||||
// Annotatable in principle but useless, fast is inline
|
||||
fast @FunAnn { arg }
|
||||
fast2(1, @FunAnn { arg })
|
||||
// Source annotation, ok
|
||||
fast @SourceAnn { arg }
|
||||
fast2(1, @SourceAnn { arg })
|
||||
// Expression annotation, ok
|
||||
fast @ExprAnn { arg }
|
||||
fast2(1, @ExprAnn { arg })
|
||||
// Function expression too
|
||||
val f = @FunAnn fun(): Int { return 42 }
|
||||
// But here, f and gav should be annotated instead
|
||||
bar(@FunAnn f)
|
||||
bar(@FunAnn ::gav)
|
||||
// Function expression, ok
|
||||
fast(f)
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// FILE: DocumentedAnnotations.java
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
public class DocumentedAnnotations {
|
||||
|
||||
@Documented public @interface DocAnn {};
|
||||
|
||||
public @interface NotDocAnn {};
|
||||
|
||||
@Documented @Retention(RetentionPolicy.RUNTIME) public @interface RunDocAnn {};
|
||||
}
|
||||
|
||||
// FILE: DocumentedAnnotations.kt
|
||||
|
||||
@DocumentedAnnotations.DocAnn class My
|
||||
|
||||
@DocumentedAnnotations.NotDocAnn class Your
|
||||
|
||||
@DocumentedAnnotations.RunDocAnn class His
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import java.lang.annotation.*
|
||||
|
||||
@java.lang.annotation.Target(ElementType.PACKAGE)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class my
|
||||
|
||||
@java.lang.annotation.Retention(RetentionPolicy.SOURCE)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class your
|
||||
@@ -0,0 +1,35 @@
|
||||
// FILE: AnnotationRetentions.java
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
public class AnnotationRetentions {
|
||||
|
||||
public @interface BaseAnnotation {
|
||||
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface SourceAnnotation {
|
||||
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
public @interface BinaryAnnotation {
|
||||
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface RuntimeAnnotation {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: AnnotationRetentions.kt
|
||||
|
||||
@AnnotationRetentions.BaseAnnotation class BaseClass
|
||||
|
||||
@AnnotationRetentions.SourceAnnotation class SourceClass
|
||||
|
||||
@AnnotationRetentions.BinaryAnnotation class BinaryClass
|
||||
|
||||
@AnnotationRetentions.RuntimeAnnotation class RuntimeClass
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class My
|
||||
data class Pair(val a: Int, val b: Int)
|
||||
fun foo(): Int {
|
||||
val (@My private a, @My public b) = Pair(12, 34)
|
||||
return a + b
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class Ann
|
||||
|
||||
open class My
|
||||
|
||||
fun foo(): My {
|
||||
return (@Ann object: My() {})
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
annotation class FunAnn
|
||||
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class ExprAnn
|
||||
|
||||
fun foo(): Int {
|
||||
var x = 5
|
||||
@FunAnn ++x
|
||||
@ExprAnn ++x
|
||||
return x
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
@Repeatable
|
||||
annotation class repann
|
||||
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@Repeatable
|
||||
annotation class repann1(val x: Int)
|
||||
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@Repeatable
|
||||
annotation class repann2(val f: Boolean)
|
||||
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Repeatable
|
||||
annotation class binrepann
|
||||
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@Repeatable
|
||||
annotation class repexpr
|
||||
|
||||
@repann @repann class DoubleAnnotated
|
||||
|
||||
@repann1(1) @repann1(2) @repann1(3) class TripleAnnotated
|
||||
|
||||
@repann2(true) @repann2(false) @repann2(false) @repann2(true) class FourTimesAnnotated
|
||||
|
||||
@binrepann @binrepann class BinaryAnnotated
|
||||
|
||||
@repann @repann fun foo(@repann @repann x: Int): Int {
|
||||
@repexpr @repexpr return x
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class sourceann
|
||||
|
||||
@sourceann class AnnotatedAtSource
|
||||
@@ -0,0 +1,8 @@
|
||||
// KT-9145
|
||||
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class Ann
|
||||
|
||||
var x: Int
|
||||
get() = 1
|
||||
set(@Ann private x) { }
|
||||
@@ -0,0 +1,4 @@
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class base
|
||||
|
||||
@base data class My(val x: Int)
|
||||
+16
@@ -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) {
|
||||
@smartget var y = x
|
||||
@base @smartget @smartset get
|
||||
@base @smartget @smartset set
|
||||
|
||||
@base @smartget @smartset fun foo() = y
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
@Target(AnnotationTarget.ANNOTATION_CLASS) annotation class base
|
||||
|
||||
@base annotation class derived
|
||||
|
||||
@base class correct(@base val x: Int) {
|
||||
@base constructor(): this(0)
|
||||
}
|
||||
|
||||
@base enum class My {
|
||||
@base FIRST,
|
||||
@base SECOND
|
||||
}
|
||||
|
||||
@base fun foo(@base y: @base Int): Int {
|
||||
@base fun bar(@base z: @base Int) = z + 1
|
||||
@base val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
@base val z = 0
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@Target(AnnotationTarget.CLASS) annotation class base
|
||||
|
||||
@base annotation class derived
|
||||
|
||||
@base class correct(@base val x: Int, @base w: @base Int) {
|
||||
@base constructor(): this(0, 0)
|
||||
}
|
||||
|
||||
@base enum class My @base constructor() {
|
||||
@base FIRST,
|
||||
@base SECOND
|
||||
}
|
||||
|
||||
@base fun foo(@base y: @base Int): Int {
|
||||
@base fun bar(@base z: @base Int) = z + 1
|
||||
@base val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
@base val z = 0
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
@Target(AnnotationTarget.CONSTRUCTOR) annotation class base
|
||||
|
||||
@base annotation class derived
|
||||
|
||||
@base class correct(@base val x: Int) {
|
||||
@base constructor(): this(0)
|
||||
}
|
||||
|
||||
@base enum class My @base constructor() {
|
||||
@base FIRST,
|
||||
@base SECOND
|
||||
}
|
||||
|
||||
@base fun foo(@base y: @base Int): Int {
|
||||
@base fun bar(@base z: @base Int) = z + 1
|
||||
@base val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
@base val z = 0
|
||||
@@ -0,0 +1,21 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@Target() annotation class empty
|
||||
|
||||
@empty annotation class derived
|
||||
|
||||
@empty class correct(@empty val x: Int, @empty w: @empty Int) {
|
||||
@empty constructor(): this(0, 0)
|
||||
}
|
||||
|
||||
@empty enum class My @empty constructor() {
|
||||
@empty FIRST,
|
||||
@empty SECOND
|
||||
}
|
||||
|
||||
@empty fun foo(@empty y: @empty Int): Int {
|
||||
@empty fun bar(@empty z: @empty Int) = z + 1
|
||||
@empty val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
@empty val z = @empty 0
|
||||
@@ -0,0 +1,13 @@
|
||||
annotation class base
|
||||
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class special
|
||||
|
||||
fun transform(i: Int, tr: (Int) -> Int): Int = @base @special tr(@special i)
|
||||
|
||||
@base @special fun foo(i: Int): Int {
|
||||
val j = @base @special i + 1
|
||||
if (j == 1) return foo(@special @base 42)
|
||||
return transform(@special j, @base @special { @special it * 2 })
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
@Target(AnnotationTarget.FIELD)
|
||||
annotation class Field
|
||||
|
||||
@Field
|
||||
annotation class Another
|
||||
|
||||
@Field
|
||||
val x: Int = 42
|
||||
|
||||
@Field
|
||||
val y: Int
|
||||
get() = 13
|
||||
|
||||
@Field
|
||||
abstract class My(@Field arg: Int, @Field val w: Int) {
|
||||
@Field
|
||||
val x: Int = arg
|
||||
|
||||
@Field
|
||||
val y: Int
|
||||
get() = 0
|
||||
|
||||
@Field
|
||||
abstract val z: Int
|
||||
|
||||
@Field
|
||||
fun foo() {}
|
||||
|
||||
@Field
|
||||
val v: Int by <!UNRESOLVED_REFERENCE!>Delegates<!>.<!UNRESOLVED_REFERENCE!>lazy<!> { 42 }
|
||||
}
|
||||
|
||||
enum class Your {
|
||||
@Field FIRST
|
||||
}
|
||||
|
||||
interface His {
|
||||
@Field
|
||||
val x: Int
|
||||
|
||||
@Field
|
||||
val y: Int
|
||||
get() = 42
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@special class Incorrect
|
||||
|
||||
// FILE: another.kt
|
||||
|
||||
@file:common
|
||||
|
||||
package test
|
||||
|
||||
@common class Correct
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
@Target(AnnotationTarget.FUNCTION) annotation class base
|
||||
|
||||
@base annotation class derived
|
||||
|
||||
@base class correct(@base val x: Int) {
|
||||
@base constructor(): this(0)
|
||||
|
||||
@base public fun baz() {}
|
||||
}
|
||||
|
||||
@base enum class My @base constructor() {
|
||||
@base FIRST,
|
||||
@base SECOND
|
||||
}
|
||||
|
||||
@base fun foo(@base y: @base Int): Int {
|
||||
@base fun bar(@base z: @base Int) = z + 1
|
||||
@base val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
@base val z = 0
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class special
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class base
|
||||
|
||||
fun transform(i: Int, tr: (@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 -> @base i * 2 })
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@Target(AnnotationTarget.<!UNRESOLVED_REFERENCE!>INIT<!>) annotation class incorrect
|
||||
|
||||
@incorrect annotation class derived
|
||||
|
||||
@incorrect class correct(@incorrect val x: Int, @incorrect w: @incorrect Int) {
|
||||
@incorrect constructor(): this(0, 0)
|
||||
}
|
||||
|
||||
@incorrect enum class My @incorrect constructor() {
|
||||
@incorrect FIRST,
|
||||
@incorrect SECOND
|
||||
}
|
||||
|
||||
@incorrect fun foo(@incorrect y: @incorrect Int): Int {
|
||||
@incorrect fun bar(@incorrect z: @incorrect Int) = z + 1
|
||||
@incorrect val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
@incorrect val z = @incorrect 0
|
||||
@@ -0,0 +1,6 @@
|
||||
annotation class base
|
||||
|
||||
@base class My {
|
||||
@base init {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
// FILE: test/AnnotationTargets.java
|
||||
|
||||
package test;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
public class AnnotationTargets {
|
||||
|
||||
public @interface base {
|
||||
|
||||
}
|
||||
|
||||
@Target(ElementType.ANNOTATION_TYPE)
|
||||
public @interface meta {
|
||||
|
||||
}
|
||||
|
||||
@Target(ElementType.CONSTRUCTOR)
|
||||
public @interface konstructor {
|
||||
|
||||
}
|
||||
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface fieldann {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Target(ElementType.LOCAL_VARIABLE)
|
||||
public @interface local {
|
||||
|
||||
}
|
||||
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface method {
|
||||
|
||||
}
|
||||
|
||||
@Target(ElementType.PARAMETER)
|
||||
public @interface parameter {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface type {
|
||||
|
||||
}
|
||||
|
||||
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD})
|
||||
public @interface multiple {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test/AnnotationTargets.kt
|
||||
|
||||
@file:AnnotationTargets.type
|
||||
package test
|
||||
|
||||
import test.AnnotationTargets.*
|
||||
|
||||
@base @meta @type @konstructor annotation class KMeta
|
||||
|
||||
@base @meta @type @method @multiple class KClass(
|
||||
@base @fieldann @parameter val y:
|
||||
@base @type Int) {
|
||||
|
||||
@base @multiple @fieldann @local val x = 0
|
||||
@method @konstructor @type get
|
||||
|
||||
@base @method @multiple @konstructor
|
||||
fun foo(@parameter @type i:
|
||||
@base @multiple Int
|
||||
): @fieldann @parameter Int {
|
||||
|
||||
@local @base @multiple @fieldann val j = i + 1
|
||||
@base @multiple return j
|
||||
}
|
||||
|
||||
@base @method @konstructor constructor(): this(0)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
@Target(AnnotationTarget.LOCAL_VARIABLE) annotation class base
|
||||
|
||||
@base annotation class derived
|
||||
|
||||
@base class correct(@base val x: Int) {
|
||||
@base constructor(): this(0)
|
||||
}
|
||||
|
||||
@base enum class My {
|
||||
@base FIRST,
|
||||
@base SECOND
|
||||
}
|
||||
|
||||
@base fun foo(@base y: @base Int): Int {
|
||||
@base fun bar(@base z: @base Int) = z + 1
|
||||
@base val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
@base val z = 0
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class base
|
||||
|
||||
@Target(AnnotationTarget.ANNOTATION_CLASS)
|
||||
annotation class meta
|
||||
|
||||
@base class Outer {
|
||||
@base @meta class Nested
|
||||
|
||||
@base @meta annotation class Annotated
|
||||
|
||||
fun foo() {
|
||||
@base @meta class Local
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@Target(AnnotationTarget.PROPERTY) annotation class base
|
||||
|
||||
@base annotation class derived
|
||||
|
||||
@base class correct(@base val x: Int, @base w: Int) {
|
||||
@base constructor(): this(0, 0)
|
||||
}
|
||||
|
||||
@base enum class My {
|
||||
@base FIRST,
|
||||
@base SECOND
|
||||
}
|
||||
|
||||
@base fun foo(@base y: @base Int): Int {
|
||||
@base fun bar(@base z: @base Int) = z + 1
|
||||
@base val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
@base val z = 0
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
annotation class base
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class typed
|
||||
|
||||
@base class My(val x: @base @typed Int, y: @base @typed Int) {
|
||||
val z: @base @typed Int = y
|
||||
fun foo(): @base @typed Int = z
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
@file:Suppress("abc")
|
||||
|
||||
fun foo(): Int {
|
||||
@Suppress("xyz") return 1
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
@Target(AnnotationTarget.TYPE) annotation class base
|
||||
|
||||
@base annotation class derived
|
||||
|
||||
@base class correct(@base val x: @base Int) {
|
||||
@base constructor(): this(0)
|
||||
}
|
||||
|
||||
@base enum class My @base constructor() {
|
||||
@base FIRST,
|
||||
@base SECOND
|
||||
}
|
||||
|
||||
@base fun foo(@base y: @base Int): Int {
|
||||
@base fun bar(@base z: @base Int) = z + 1
|
||||
@base val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
@base val z = 0
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@Target(AnnotationTarget.TYPE_PARAMETER)
|
||||
annotation class A
|
||||
|
||||
@Target(AnnotationTarget.TYPE_PARAMETER)
|
||||
annotation class B(val i: Int = 12)
|
||||
|
||||
|
||||
fun <@A @B(3) T> topFun() = 12
|
||||
|
||||
class Class1 {
|
||||
fun <@A @B(3)T> method() = 12
|
||||
|
||||
fun foo() {
|
||||
fun <@A @B(3) T> innerFun() = 12
|
||||
}
|
||||
}
|
||||
|
||||
val <@A @B(3) T> T.topProp: Int get() = 12
|
||||
|
||||
class Class2 {
|
||||
val <@A @B(3) T> T.field: Int get() = 12
|
||||
}
|
||||
|
||||
|
||||
@A fun foo() {}
|
||||
@A class D
|
||||
fun foo(i: @A Int) {
|
||||
@A val i = 1
|
||||
}
|
||||
fun <T> test(t: @A T): T = t
|
||||
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
internal annotation class C
|
||||
|
||||
fun <@C T> test2(t: T): T = t
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
annotation class base
|
||||
|
||||
val x: List<@base String>? = null
|
||||
|
||||
val y: List<@[base] String>? = null
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class typeAnn
|
||||
|
||||
fun foo(list: List<@typeAnn Int>) = list
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER) annotation class base
|
||||
|
||||
@base annotation class derived
|
||||
|
||||
@base class correct(@base val x: Int, @base w: Int) {
|
||||
@base constructor(): this(0, 0)
|
||||
}
|
||||
|
||||
@base enum class My {
|
||||
@base FIRST,
|
||||
@base SECOND
|
||||
}
|
||||
|
||||
@base fun foo(@base y: @base Int): Int {
|
||||
@base fun bar(@base z: @base Int) = z + 1
|
||||
@base val local = bar(y)
|
||||
return local
|
||||
}
|
||||
|
||||
@base val z = 0
|
||||
@@ -0,0 +1,23 @@
|
||||
annotation class unrepann(val x: Int)
|
||||
|
||||
annotation class ann(val y: Int)
|
||||
|
||||
@unrepann(1) @unrepann(2) class DoubleAnnotated
|
||||
|
||||
@ann(3) @ann(7) @ann(42) class TripleAnnotated
|
||||
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class annexpr
|
||||
|
||||
@ann(0) @ann(1) fun foo(@ann(7) @ann(2) x: Int): Int {
|
||||
@annexpr @annexpr return x
|
||||
}
|
||||
|
||||
@unrepann(0)
|
||||
@get:unrepann(1)
|
||||
var annotated = 1 // No errors should be here
|
||||
|
||||
@unrepann(0)
|
||||
@property:unrepann(1)
|
||||
var annotated2 = 2
|
||||
Reference in New Issue
Block a user