[FIR-TEST] Add new testdata generated after changes in previous commit

This commit is contained in:
Dmitriy Novozhilov
2019-12-11 16:16:22 +03:00
parent e9c02a1cca
commit 2536fa0cd5
4578 changed files with 104067 additions and 1 deletions
@@ -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
}
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 })
}
@@ -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
@@ -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
}
}
@@ -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
@@ -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
}
@@ -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
@@ -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
@@ -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
@@ -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