[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,33 @@
import kotlin.reflect.KProperty
@Target(AnnotationTarget.FIELD) annotation class Field
@Target(AnnotationTarget.PROPERTY) annotation class Prop
class CustomDelegate {
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name
}
@delegate:Field
class SomeClass {
@delegate:Field
constructor()
@delegate:Field @delegate:Prop
protected val simpleProperty: String = "text"
@delegate:Field @delegate:Prop
protected val delegatedProperty: String by CustomDelegate()
@delegate:Field @delegate:Prop
val propertyWithCustomGetter: Int
get() = 5
}
class WithPrimaryConstructor(@delegate:Field @delegate:Prop val a: String,
@param:Field @param:Prop val b: String)
fun foo(@delegate:Field @delegate:Prop x: Int) = x
@@ -0,0 +1,36 @@
import kotlin.reflect.KProperty
annotation class Ann
class CustomDelegate {
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name
}
@field:Ann
class SomeClass {
@field:Ann
constructor()
@field:Ann
protected val simpleProperty: String = "text"
@field:[Ann]
protected val simplePropertyWithAnnotationList: String = "text"
@field:Ann
protected val delegatedProperty: String by CustomDelegate()
@field:Ann
val propertyWithCustomGetter: Int
get() = 5
@field:Ann
fun anotherFun(@field:Ann s: String) {
@field:Ann
val localVariable = 5
}
}
class WithPrimaryConstructor(@field:Ann val a: String)
@@ -0,0 +1,12 @@
// FILE: annotations.kt
@Target(AnnotationTarget.CLASS)
public annotation class ClassAnn
@Target(AnnotationTarget.FILE)
public annotation class FileAnn
// FILE: 1.kt
@file:ClassAnn
// FILE: 2.kt
@file:FileAnn
@@ -0,0 +1,39 @@
import kotlin.reflect.KProperty
annotation class Ann
class CustomDelegate {
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name
}
@get:Ann
class SomeClass {
@get:Ann
constructor()
@get:Ann
protected val simpleProperty: String = "text"
@get:Ann
protected var mutableProperty: String = "text"
@get:[Ann]
protected val simplePropertyWithAnnotationList: String = "text"
@get:Ann
protected val delegatedProperty: String by CustomDelegate()
@get:Ann
val propertyWithCustomGetter: Int
get() = 5
@get:Ann
fun annotationOnFunction(a: Int) = a + 5
fun anotherFun() {
@get:Ann
val localVariable = 5
}
}
@@ -0,0 +1,24 @@
annotation class Ann
annotation class Second
@param:Ann
class SomeClass {
@param:Ann
constructor(@param:Ann a: String)
@param:Ann
protected val simpleProperty: String = "text"
@param:Ann
fun anotherFun() {
@param:Ann
val localVariable = 5
}
}
class PrimaryConstructorClass(
@param:Ann a: String,
@param:[Ann Second] b: String,
@param:Ann val c: String)
@@ -0,0 +1,39 @@
import kotlin.reflect.KProperty
annotation class Ann
annotation class Second
class CustomDelegate {
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name
}
@property:Ann
class SomeClass {
@property:Ann
constructor(s: String)
@property:Ann
protected val p1: String = ""
@property:[Ann Second]
protected val p2: String = ""
@property:Ann
protected var p3: String = ""
@property:Ann
protected val p4: String by CustomDelegate()
@property:Ann
var propertyWithCustomSetter: Int
get() = 5
set(v) {}
@property:Ann
fun anotherFun() {
@property:Ann
val localVariable = 5
}
}
@@ -0,0 +1,25 @@
annotation class Ann
@receiver:Ann
class SomeClass {
@receiver:Ann
constructor(@receiver:Ann a: String)
@receiver:Ann
protected val simpleProperty: String = "text"
@receiver:Ann
fun anotherFun() {
@receiver:Ann
val localVariable = 5
}
val @receiver:Ann String.extensionProperty2: String
get() = "A"
}
fun @receiver:Ann String.length2() = length
val @receiver:Ann String.extensionProperty: String
get() = "A"
@@ -0,0 +1,38 @@
import kotlin.reflect.KProperty
annotation class Ann
class CustomDelegate {
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name
operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: String) {}
}
@set:Ann
class SomeClass {
@set:Ann
protected val simpleProperty: String = "text"
@set:Ann
protected var mutableProperty: String = "text"
@set:[Ann]
protected var mutablePropertyWithAnnotationList: String = "text"
@set:Ann
protected var delegatedProperty: String by CustomDelegate()
@set:Ann
var propertyWithCustomSetter: Int
get() = 5
set(v) {}
@set:Ann
fun annotationOnFunction(a: Int) = a + 5
fun anotherFun() {
@set:Ann
val localVariable = 5
}
}
@@ -0,0 +1,39 @@
import kotlin.reflect.KProperty
annotation class Ann
class CustomDelegate {
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name
operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: String) {}
}
@setparam:Ann
class SomeClass {
@setparam:Ann
constructor()
@setparam:Ann
protected val simpleProperty: String = "text"
@setparam:Ann
protected var mutableProperty: String = "text"
@setparam:[Ann]
protected var mutablePropertyWithAnnotationList: String = "text"
@setparam:Ann
protected var delegatedProperty: String by CustomDelegate()
@setparam:Ann
var propertyWithCustomSetter: Int
get() = 5
set(v) {}
@setparam:Ann
fun anotherFun() {
@setparam:Ann
val localVariable = 5
}
}
@@ -0,0 +1,20 @@
package bar
@file:foo
val prop
@file:[bar baz]
fun func() {}
@file:[baz]
class C
<!SYNTAX!>@file:<!>
interface T
@file:[<!SYNTAX!><!>]
interface T
annotation class foo
annotation class bar
annotation class baz
@@ -0,0 +1,8 @@
@file:foo
@foo @bar
@file:[baz]
fun test() {}
annotation class foo
annotation class bar
annotation class baz
@@ -0,0 +1,8 @@
@file:foo
@foo @bar
@file: baz
fun test() {}
annotation class foo
annotation class bar
annotation class baz
@@ -0,0 +1,11 @@
// !LANGUAGE: +RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun test1(@file<!SYNTAX!><!> Suppress("") x: Int) {}
@file <!SYNTAX!>@<!>Suppress("")
fun test2() {}
class OnType(x: @file<!SYNTAX!><!> Suppress("") Int)
fun @file : Suppress("") Int.test3() {}
@@ -0,0 +1,11 @@
// !LANGUAGE: -RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun test1(@file<!SYNTAX!><!> Suppress("") x: Int) {}
@file <!SYNTAX!>@<!>Suppress("")
fun test2() {}
class OnType(x: @file<!SYNTAX!><!> Suppress("") Int)
fun @file : Suppress("") Int.test3() {}
@@ -0,0 +1,9 @@
// !LANGUAGE: -ProhibitUseSiteTargetAnnotationsOnSuperTypes
interface Foo
annotation class Ann
class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo
interface G : @Ann Foo
@@ -0,0 +1,9 @@
// !LANGUAGE: +ProhibitUseSiteTargetAnnotationsOnSuperTypes
interface Foo
annotation class Ann
class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo
interface G : @Ann Foo
@@ -0,0 +1,22 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !LANGUAGE: -ProhibitRepeatedUseSiteTargetAnnotations
// Ann is not repeatable
annotation class Ann(val x: Int)
@get:Ann(10)
val a: String
@Ann(20) get() = "foo"
@set:Ann(10)
var b: String = ""
@Ann(20) set(value) { field = value }
@setparam:Ann(10)
var c = " "
set(@Ann(20) x) {}
@get:Ann(10)
@get:Ann(20)
val d: String
@Ann(30) @Ann(40) get() = "foo"
@@ -0,0 +1,22 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !LANGUAGE: +ProhibitRepeatedUseSiteTargetAnnotations
// Ann is not repeatable
annotation class Ann(val x: Int)
@get:Ann(10)
val a: String
@Ann(20) get() = "foo"
@set:Ann(10)
var b: String = ""
@Ann(20) set(value) { field = value }
@setparam:Ann(10)
var c = " "
set(@Ann(20) x) {}
@get:Ann(10)
@get:Ann(20)
val d: String
@Ann(30) @Ann(40) get() = "foo"
@@ -0,0 +1,10 @@
// !LANGUAGE: +RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes
@Target(AnnotationTarget.VALUE_PARAMETER)
annotation class Fancy
fun @receiver:Fancy String.myExtension() { }
val @receiver:Fancy Int.asVal get() = 0
fun ((@receiver:Fancy Int) -> Unit).complexReceiver1() {}
fun ((Int) -> @receiver:Fancy Unit).complexReceiver2() {}
@@ -0,0 +1,10 @@
// !LANGUAGE: -RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes
@Target(AnnotationTarget.VALUE_PARAMETER)
annotation class Fancy
fun @receiver:Fancy String.myExtension() { }
val @receiver:Fancy Int.asVal get() = 0
fun ((@receiver:Fancy Int) -> Unit).complexReceiver1() {}
fun ((Int) -> @receiver:Fancy Unit).complexReceiver2() {}
@@ -0,0 +1,59 @@
import kotlin.reflect.KProperty
@Retention(AnnotationRetention.SOURCE)
@Repeatable
annotation class RepeatableAnn
annotation class Ann
class CustomDelegate {
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name
}
public class A(@param:Ann @Ann val x: Int, @param: RepeatableAnn @Ann val y: Int) {
@field:Ann @property:Ann @RepeatableAnn @property:RepeatableAnn
val a: Int = 0
@Ann @field:Ann @property:Ann
val b: Int = 0
@field:RepeatableAnn @field:RepeatableAnn
val c: Int = 0
@property:RepeatableAnn @RepeatableAnn
val d: Int = 0
@property:RepeatableAnn @RepeatableAnn @delegate:RepeatableAnn
val e: String by CustomDelegate()
@property:Ann @delegate:Ann
val f: String by CustomDelegate()
@Ann @delegate:Ann
val g: String by CustomDelegate()
@Ann @field:Ann
val h: String = ""
@property:Ann @field:Ann
val i: String = ""
}
@Target(AnnotationTarget.FIELD, AnnotationTarget.PROPERTY)
annotation class fieldOrPropAnn
@Target(AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.VALUE_PARAMETER)
annotation class getSetAndParamAnn
public class B(@param:fieldOrPropAnn @fieldOrPropAnn val x: Int,
@property:fieldOrPropAnn @fieldOrPropAnn val y: Int) {
@fieldOrPropAnn @field:fieldOrPropAnn
val z: Int = 42
@getSetAndParamAnn
@setparam:getSetAndParamAnn
var w: Int
@getSetAndParamAnn @get:getSetAndParamAnn get() = 0
// See KT-15470: fake INAPPLICABLE_TARGET_ON_PROPERTY
@getSetAndParamAnn @set:getSetAndParamAnn set(arg) {}
}
@@ -0,0 +1,13 @@
// !LANGUAGE: +RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun test1(i: @setparam:Suppress Int) {}
fun test2(i: @param:Suppress Int) {}
fun test3(i: @receiver:Suppress Int) {}
fun test4(): @setparam:Suppress Int = TODO()
fun test5(i: (@setparam:Suppress Int) -> Unit) {}
fun ((@setparam:Suppress Int) -> Unit).test6() {}
fun test7(): ((@setparam:Suppress Int) -> Unit) = TODO()
@@ -0,0 +1,13 @@
// !LANGUAGE: +RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun test1(i: @setparam:Suppress Int) {}
fun test2(i: @param:Suppress Int) {}
fun test3(i: @receiver:Suppress Int) {}
fun test4(): @setparam:Suppress Int = TODO()
fun test5(i: (@setparam:Suppress Int) -> Unit) {}
fun ((@setparam:Suppress Int) -> Unit).test6() {}
fun test7(): ((@setparam:Suppress Int) -> Unit) = TODO()
@@ -0,0 +1,13 @@
// !LANGUAGE: -RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun test1(i: @setparam:Suppress Int) {}
fun test2(i: @param:Suppress Int) {}
fun test3(i: @receiver:Suppress Int) {}
fun test4(): @setparam:Suppress Int = TODO()
fun test5(i: (@setparam:Suppress Int) -> Unit) {}
fun ((@setparam:Suppress Int) -> Unit).test6() {}
fun test7(): ((@setparam:Suppress Int) -> Unit) = TODO()