[IR] dumpKotlinLike: add testdata for FIR tests
This commit is contained in:
committed by
teamcityserver
parent
d7bd4240e1
commit
c68040753d
@@ -0,0 +1,80 @@
|
||||
class Test1<T1 : Any?, T2 : Any?> {
|
||||
constructor(x: T1, y: T2) /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val x: T1
|
||||
field = x
|
||||
get
|
||||
|
||||
val y: T2
|
||||
field = y
|
||||
get
|
||||
|
||||
}
|
||||
|
||||
class Test2 {
|
||||
constructor(x: Int, y: String) /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val y: String
|
||||
field = y
|
||||
get
|
||||
|
||||
inner class TestInner<Z : Any?> {
|
||||
constructor(z: Z) /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val z: Z
|
||||
field = z
|
||||
get
|
||||
|
||||
constructor(z: Z, i: Int) {
|
||||
<this>.this/*TestInner*/<Z>(z = z)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Test3 {
|
||||
constructor(x: Int, y: String = "") /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val x: Int
|
||||
field = x
|
||||
get
|
||||
|
||||
val y: String
|
||||
field = y
|
||||
get
|
||||
|
||||
}
|
||||
|
||||
class Test4<T : Any?> {
|
||||
constructor(x: Int) /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val x: Int
|
||||
field = x
|
||||
get
|
||||
|
||||
constructor(x: Int, y: Int = 42) {
|
||||
this/*Test4*/<T>(x = x.plus(other = y))
|
||||
}
|
||||
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
data class Test<T : Any?> {
|
||||
constructor(x: T, y: String = "") /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val x: T
|
||||
field = x
|
||||
get
|
||||
|
||||
val y: String
|
||||
field = y
|
||||
get
|
||||
|
||||
fun component1(): T {
|
||||
return <this>.#x
|
||||
}
|
||||
|
||||
fun component2(): String {
|
||||
return <this>.#y
|
||||
}
|
||||
|
||||
fun copy(x: T = <this>.#x, y: String = <this>.#y): Test<T> {
|
||||
return Test<Any>(x = x, y = y)
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
when {
|
||||
EQEQEQ(arg0 = <this>, arg1 = other) -> return true
|
||||
}
|
||||
when {
|
||||
other !is Test<T> -> return false
|
||||
}
|
||||
val tmp0_other_with_cast: Test<T> = other as Test<T>
|
||||
when {
|
||||
EQEQ(arg0 = <this>.#x, arg1 = tmp0_other_with_cast.#x).not() -> return false
|
||||
}
|
||||
when {
|
||||
EQEQ(arg0 = <this>.#y, arg1 = tmp0_other_with_cast.#y).not() -> return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result: Int = when {
|
||||
EQEQ(arg0 = <this>.#x, arg1 = null) -> 0
|
||||
else -> <this>.#x.hashCode()
|
||||
}
|
||||
result = result.times(other = 31).plus(other = <this>.#y.hashCode())
|
||||
return result
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "Test(" + "x=" + <this>.#x + ", " + "y=" + <this>.#y + ")"
|
||||
}
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
interface IBase<T : Any?> {
|
||||
abstract fun foo(x: Int)
|
||||
abstract val bar: Int
|
||||
abstract get
|
||||
|
||||
abstract fun <X : Any?> qux(t: T, x: X)
|
||||
|
||||
}
|
||||
|
||||
class Test<TT : Any?> : IBase<TT> {
|
||||
constructor(impl: IBase<TT>) /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
<this>.#<$$delegate_0> = impl
|
||||
}
|
||||
|
||||
override fun foo(x: Int) {
|
||||
<this>.#<$$delegate_0>.foo(x = x)
|
||||
}
|
||||
|
||||
override fun <X : Any?> qux(t: TT, x: X) {
|
||||
<this>.#<$$delegate_0>.qux</* null */>(t = t, x = x)
|
||||
}
|
||||
|
||||
override val bar: Int
|
||||
override get(): Int {
|
||||
return <this>.#<$$delegate_0>.<get-bar>()
|
||||
}
|
||||
|
||||
local /*final field*/ val <$$delegate_0>: IBase<TT>
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
val test1: Function1<String, String>
|
||||
field = local fun <anonymous>(it: String): String {
|
||||
return it
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val test2: @ExtensionFunctionType @ExtensionFunctionType Function2<Any, Any, Any>
|
||||
field = local fun Any.<anonymous>(it: Any): Int {
|
||||
return it.hashCode()
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val test3: Function2<Int, Int, Unit>
|
||||
field = local fun <anonymous>(i: Int, j: Int) {
|
||||
return Unit
|
||||
}
|
||||
|
||||
get
|
||||
|
||||
val test4: Function2<Int, Int, Unit>
|
||||
field = local fun <no name provided>(i: Int, j: Int) {
|
||||
}
|
||||
|
||||
get
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
class Test1<T : U, U : Any?> {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun <T : U, U : Any?> test2() {
|
||||
}
|
||||
|
||||
var <T : U, U : Any?> Test1<T, U>.test3: Unit
|
||||
get() {
|
||||
}
|
||||
set(value: Unit) {
|
||||
}
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
abstract class Base1<T : Derived1> {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Derived1 : Base1<Derived1> {
|
||||
constructor() /* primary */ {
|
||||
super/*Base1*/<Derived1>()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
abstract class Base2 {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
fun <T : Derived2> foo(x: T) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Derived2 : Base2 {
|
||||
constructor() /* primary */ {
|
||||
super/*Base2*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
fun f(f1: Function0<String> = local fun <anonymous>(): ErrorType /* ERROR */ {
|
||||
return error("") /* ERROR CALL */
|
||||
}
|
||||
, f2: Function0<String> = local fun <anonymous>(): String {
|
||||
return "FAIL"
|
||||
}
|
||||
): String {
|
||||
return f1.invoke()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result: String = "fail"
|
||||
try f()
|
||||
catch (e: Exception){ // BLOCK
|
||||
result = "OK"
|
||||
}
|
||||
/*~> Unit */
|
||||
return f(, f2 = local fun <anonymous>(): String {
|
||||
return "O"
|
||||
}
|
||||
).plus(other = f(f1 = local fun <anonymous>(): String {
|
||||
return "K"
|
||||
}
|
||||
))
|
||||
}
|
||||
Reference in New Issue
Block a user