[IR] dumpKotlinLike: add testdata for FIR tests

This commit is contained in:
Zalim Bashorov
2020-11-20 18:18:14 +03:00
committed by teamcityserver
parent d7bd4240e1
commit c68040753d
298 changed files with 12186 additions and 0 deletions
@@ -0,0 +1,28 @@
annotation class A1 : Annotation {
constructor(x: Int) /* primary */
val x: Int
field = x
get
}
annotation class A2 : Annotation {
constructor(a: A1) /* primary */
val a: A1
field = a
get
}
annotation class AA : Annotation {
constructor(xs: Array<A1>) /* primary */
val xs: Array<A1>
field = xs
get
}
@A2(a = A1(x = 42))
@AA(xs = [A1(x = 1), A1(x = 2)])
fun test() {
}
@@ -0,0 +1,50 @@
annotation class Ann : Annotation {
constructor() /* primary */
}
interface IFoo {
@Ann
abstract val testVal: String
abstract get
@Ann
abstract fun testFun()
@Ann
abstract val String.testExtVal: String
abstract get
@Ann
abstract fun String.testExtFun()
}
class DFoo : IFoo {
constructor(d: IFoo) /* primary */ {
super/*Any*/()
/* <init>() */
<this>.#<$$delegate_0> = d
}
override fun testFun() {
<this>.#<$$delegate_0>.testFun()
}
override fun String.testExtFun() {
(<this>.#<$$delegate_0>, <this>).testExtFun()
}
override val testVal: String
override get(): String {
return <this>.#<$$delegate_0>.<get-testVal>()
}
override val String.testExtVal: String
override get(): String {
return (<this>.#<$$delegate_0>, <this>).<get-testExtVal>()
}
local /*final field*/ val <$$delegate_0>: IFoo
}
@@ -0,0 +1,31 @@
annotation class A : Annotation {
constructor(x: String = "", y: Int = 42) /* primary */
val x: String
field = x
get
val y: Int
field = y
get
}
@A(x = "abc", y = 123)
fun test1() {
}
@A(x = "def")
fun test2() {
}
@A(x = "ghi")
fun test3() {
}
@A(, y = 456)
fun test4() {
}
@A
fun test5() {
}
@@ -0,0 +1,19 @@
annotation class A : Annotation {
constructor(vararg xs: String) /* primary */
val xs: Array<out String>
field = xs
get
}
@A(xs = ["abc", "def"])
fun test1() {
}
@A(xs = ["abc"])
fun test2() {
}
@A(xs = [])
fun test3() {
}
@@ -0,0 +1,25 @@
annotation class TestAnnWithIntArray : Annotation {
constructor(x: IntArray) /* primary */
val x: IntArray
field = x
get
}
annotation class TestAnnWithStringArray : Annotation {
constructor(x: Array<String>) /* primary */
val x: Array<String>
field = x
get
}
@TestAnnWithIntArray(x = [1, 2, 3])
@TestAnnWithStringArray(x = ["a", "b", "c"])
fun test1() {
}
@TestAnnWithIntArray(x = [4, 5, 6])
@TestAnnWithStringArray(x = ["d", "e", "f"])
fun test2() {
}
@@ -0,0 +1,20 @@
annotation class A : Annotation {
constructor(klass: KClass<*>) /* primary */
val klass: KClass<*>
field = klass
get
}
class C {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
@A(klass = C::class)
fun test1() {
}
@@ -0,0 +1,71 @@
annotation class TestAnn : Annotation {
constructor(x: String) /* primary */
val x: String
field = x
get
}
@TestAnn(x = "class")
class TestClass {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
@TestAnn(x = "interface")
interface TestInterface {
}
@TestAnn(x = "object")
object TestObject {
private constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
class Host {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
@TestAnn(x = "companion")
companion object TestCompanion {
private constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
}
@TestAnn(x = "enum")
enum class TestEnum : Enum<TestEnum> {
private constructor() /* primary */ {
super/*Enum*/<TestEnum>()
/* <init>() */
}
fun values(): Array<TestEnum> /* Synthetic body for ENUM_VALUES */
fun valueOf(value: String): TestEnum /* Synthetic body for ENUM_VALUEOF */
}
@TestAnn(x = "annotation")
annotation class TestAnnotation : Annotation {
constructor() /* primary */
}
@@ -0,0 +1,19 @@
const val ONE: Int
field = 1
get
annotation class A : Annotation {
constructor(x: Int) /* primary */
val x: Int
field = x
get
}
@A(x = 1)
fun test1() {
}
@A(x = 2)
fun test2() {
}
@@ -0,0 +1,22 @@
annotation class TestAnn : Annotation {
constructor(x: Int) /* primary */
val x: Int
field = x
get
}
class TestClass {
@TestAnn(x = 1)
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
@TestAnn(x = 2)
constructor(x: Int) {
this/*TestClass*/()
}
}
@@ -0,0 +1,13 @@
annotation class Ann : Annotation {
constructor() /* primary */
}
val test1: Int /* by */
field = lazy<Int>(initializer = local fun <anonymous>(): Int {
return 42
}
)
get(): Int {
return #test1$delegate.getValue<Int>(thisRef = null, property = ::test1)
}
@@ -0,0 +1,47 @@
annotation class A : Annotation {
constructor(x: String) /* primary */
val x: String
field = x
get
}
class Cell {
constructor(value: Int) /* primary */ {
super/*Any*/()
/* <init>() */
}
var value: Int
field = value
get
set
operator fun getValue(thisRef: Any?, kProp: Any?): Int {
return <this>.<get-value>()
}
operator fun setValue(thisRef: Any?, kProp: Any?, newValue: Int) {
<this>.<set-value>(<set-?> = newValue)
}
}
val test1: Int /* by */
field = Cell(value = 1)
@A(x = "test1.get")
get(): Int {
return #test1$delegate.getValue(thisRef = null, kProp = ::test1)
}
var test2: Int /* by */
field = Cell(value = 2)
@A(x = "test2.get")
get(): Int {
return #test2$delegate.getValue(thisRef = null, kProp = ::test2)
}
@A(x = "test2.set")
set(@A(x = "test2.set.param") <set-?>: Int) {
#test2$delegate.setValue(thisRef = null, kProp = ::test2, newValue = <set-?>)
}
@@ -0,0 +1,39 @@
annotation class TestAnn : Annotation {
constructor(x: String) /* primary */
val x: String
field = x
get
}
open enum class TestEnum : Enum<TestEnum> {
private constructor() /* primary */ {
super/*Enum*/<TestEnum>()
/* <init>() */
}
@TestAnn(x = "ENTRY1")
ENTRY1 = TestEnum()
@TestAnn(x = "ENTRY2")
ENTRY2 = ENTRY2()
@TestAnn(x = "ENTRY2")
private enum entry class ENTRY2 : TestEnum {
private constructor() /* primary */ {
super/*TestEnum*/()
/* <init>() */
}
val x: Int
field = 42
get
}
fun values(): Array<TestEnum> /* Synthetic body for ENUM_VALUES */
fun valueOf(value: String): TestEnum /* Synthetic body for ENUM_VALUEOF */
}
@@ -0,0 +1,32 @@
enum class En : Enum<En> {
private constructor() /* primary */ {
super/*Enum*/<En>()
/* <init>() */
}
A = En()
B = En()
C = En()
D = En()
fun values(): Array<En> /* Synthetic body for ENUM_VALUES */
fun valueOf(value: String): En /* Synthetic body for ENUM_VALUEOF */
}
annotation class TestAnn : Annotation {
constructor(x: En) /* primary */
val x: En
field = x
get
}
@TestAnn(x = En.A)
fun test1() {
}
@@ -0,0 +1,16 @@
annotation class TestAnn : Annotation {
constructor(x: String) /* primary */
val x: String
field = x
get
}
val testVal: String
field = "a val"
get
var testVar: String
field = "a var"
get
set
@@ -0,0 +1,11 @@
@file:A(x = "File annotation")
package test
@Target(allowedTargets = [AnnotationTarget.FILE])
annotation class A : Annotation {
constructor(x: String) /* primary */
val x: String
field = x
get
}
@@ -0,0 +1,11 @@
annotation class TestAnn : Annotation {
constructor(x: Int) /* primary */
val x: Int
field = x
get
}
@TestAnn(x = 42)
fun testSimpleFunction() {
}
@@ -0,0 +1,64 @@
interface IFoo {
@Deprecated(message = "")
val prop: String
get(): String {
return ""
}
@Deprecated(message = "")
val String.extProp: String
get(): String {
return ""
}
}
class Delegated : IFoo {
constructor(foo: IFoo) /* primary */ {
super/*Any*/()
/* <init>() */
<this>.#<$$delegate_0> = foo
}
override val prop: String
override get(): String {
return <this>.#<$$delegate_0>.<get-prop>()
}
override val String.extProp: String
override get(): String {
return (<this>.#<$$delegate_0>, <this>).<get-extProp>()
}
local /*final field*/ val <$$delegate_0>: IFoo
}
class DefaultImpl : IFoo {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
class ExplicitOverride : IFoo {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override val prop: String
override get(): String {
return ""
}
override val String.extProp: String
override get(): String {
return ""
}
}
@@ -0,0 +1,19 @@
annotation class A : Annotation {
constructor(x: String) /* primary */
val x: String
field = x
get
}
fun foo(m: Map<String, Int>) {
val test: Int
val test$delegate: Lazy<Int> = lazy<Int>(initializer = local fun <anonymous>(): Int {
return 42
}
)
local get(): Int {
return test$delegate.getValue<Int>(thisRef = null, property = ::test)
}
}
@@ -0,0 +1,20 @@
annotation class A1 : Annotation {
constructor() /* primary */
}
annotation class A2 : Annotation {
constructor() /* primary */
}
annotation class A3 : Annotation {
constructor() /* primary */
}
@A1
@A2
@A3
fun test() {
}
@@ -0,0 +1,17 @@
annotation class Ann : Annotation {
constructor() /* primary */
}
class Test {
constructor(@Ann x: Int) /* primary */ {
super/*Any*/()
/* <init>() */
}
val x: Int
field = x
get
}
@@ -0,0 +1,12 @@
annotation class TestAnn : Annotation {
constructor(x: String) /* primary */
val x: String
field = x
get
}
@TestAnn(x = "testVal.property")
val testVal: String
field = ""
get
@@ -0,0 +1,28 @@
annotation class A : Annotation {
constructor(x: String) /* primary */
val x: String
field = x
get
}
class C {
constructor(x: Int, y: Int) /* primary */ {
super/*Any*/()
/* <init>() */
}
val x: Int
field = x
@A(x = "C.x.get")
get
var y: Int
field = y
@A(x = "C.y.get")
get
@A(x = "C.y.set")
set
}
@@ -0,0 +1,34 @@
annotation class TestAnn : Annotation {
constructor(x: String) /* primary */
val x: String
field = x
get
}
val test1: String
@TestAnn(x = "test1.get")
get(): String {
return ""
}
var test2: String
@TestAnn(x = "test2.get")
get(): String {
return ""
}
@TestAnn(x = "test2.set")
set(value: String) {
}
val test3: String
field = ""
@TestAnn(x = "test3.get")
get
var test4: String
field = ""
@TestAnn(x = "test4.get")
get
@TestAnn(x = "test4.set")
set
@@ -0,0 +1,23 @@
annotation class AnnParam : Annotation {
constructor() /* primary */
}
var p: Int
field = 0
get
set
class C {
constructor(p: Int) /* primary */ {
super/*Any*/()
/* <init>() */
}
var p: Int
field = p
get
set
}
@@ -0,0 +1,31 @@
annotation class Ann : Annotation {
constructor() /* primary */
}
class A {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
fun @Ann String.f(): String {
return ""
}
val @Ann String?.p: String
get(): String {
return ""
}
}
fun @Ann String?.topLevelF(): String {
return ""
}
val @Ann String.topLevelP: String
get(): String {
return ""
}
@@ -0,0 +1,11 @@
annotation class A : Annotation {
constructor(vararg xs: String) /* primary */
val xs: Array<out String>
field = xs
get
}
@A(xs = ["a", "b"])
fun test() {
}
@@ -0,0 +1,10 @@
@TestAnn(x = "TestTypeAlias")
typealias TestTypeAlias = String
@Target(allowedTargets = [AnnotationTarget.TYPEALIAS])
annotation class TestAnn : Annotation {
constructor(x: String) /* primary */
val x: String
field = x
get
}
@@ -0,0 +1,8 @@
@Target(allowedTargets = [AnnotationTarget.TYPE_PARAMETER])
annotation class Anno : Annotation {
constructor() /* primary */
}
fun <T : Any?> foo() {
}
@@ -0,0 +1,23 @@
annotation class TestAnn : Annotation {
constructor(x: String) /* primary */
val x: String
field = x
get
}
fun testFun(@TestAnn(x = "testFun.x") x: Int) {
}
class TestClassConstructor1 {
constructor(@TestAnn(x = "TestClassConstructor1.x") x: Int) /* primary */ {
super/*Any*/()
/* <init>() */
}
val xx: Int
field = x
get
}
@@ -0,0 +1,35 @@
annotation class A1 : Annotation {
constructor(vararg xs: Int) /* primary */
val xs: IntArray
field = xs
get
}
annotation class A2 : Annotation {
constructor(vararg xs: String) /* primary */
val xs: Array<out String>
field = xs
get
}
annotation class AA : Annotation {
constructor(vararg xs: A1) /* primary */
val xs: Array<out A1>
field = xs
get
}
@A1(xs = [1, 2, 3])
@A2(xs = ["a", "b", "c"])
@AA(xs = [A1(xs = [4]), A1(xs = [5]), A1(xs = [6])])
fun test1() {
}
@A1(xs = [])
@A2(xs = [])
@AA(xs = [])
fun test2() {
}
@@ -0,0 +1,12 @@
annotation class TestAnn : Annotation {
constructor(x: String) /* primary */
val x: String
field = x
get
}
fun foo() {
val testVal: String = "testVal"
var testVar: String = "testVar"
}