[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,6 @@
val anonymous: Function0<Unit>
field = local fun <no name provided>() {
println()
}
get
@@ -0,0 +1,65 @@
data class A {
constructor(x: Int, y: Int) /* primary */ {
super/*Any*/()
/* <init>() */
}
val x: Int
field = x
get
val y: Int
field = y
get
fun component1(): Int {
return <this>.#x
}
fun component2(): Int {
return <this>.#y
}
fun copy(x: Int = <this>.#x, y: Int = <this>.#y): A {
return A(x = x, y = y)
}
override fun equals(other: Any?): Boolean {
when {
EQEQEQ(arg0 = <this>, arg1 = other) -> return true
}
when {
other !is A -> return false
}
val tmp0_other_with_cast: A = other as A
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 = <this>.#x.hashCode()
result = result.times(other = 31).plus(other = <this>.#y.hashCode())
return result
}
override fun toString(): String {
return "A(" + "x=" + <this>.#x + ", " + "y=" + <this>.#y + ")"
}
}
var fn: Function1<A, Int>
field = local fun <anonymous>(<destruct>: A): Int {
val _: Int = <destruct>.component1()
val y: Int = <destruct>.component2()
return 42.plus(other = y)
}
get
set
@@ -0,0 +1,6 @@
fun test1(): Int {
return "42".run<String, Int>(block = local fun String.<anonymous>(): Int {
return <this>.<get-length>()
}
)
}
@@ -0,0 +1,10 @@
fun outer() {
var x: Int = 0
local fun local() {
val <unary>: Int = x
x = <unary>.inc()
<unary> /*~> Unit */
}
local()
}
@@ -0,0 +1,45 @@
object A {
private constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
object B {
private constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
interface IFoo {
val A.foo: B
get(): B {
return B
}
}
interface IInvoke {
operator fun B.invoke(): Int {
return 42
}
}
fun test(fooImpl: IFoo, invokeImpl: IInvoke) {
with<A, Int>(receiver = A, block = local fun A.<anonymous>(): Int {
return with<IFoo, Int>(receiver = fooImpl, block = local fun IFoo.<anonymous>(): Int {
return with<IInvoke, Int>(receiver = invokeImpl, block = local fun IInvoke.<anonymous>(): Int {
return (<this>, (<this>, <this>).<get-foo>()).invoke()
}
)
}
)
}
) /*~> Unit */
}
@@ -0,0 +1,50 @@
fun test0() {
run<Nothing>(block = local fun <anonymous>(): Nothing {
return Unit
}
)
}
fun test1() {
run<Unit>(block = local fun <anonymous>() {
return Unit
}
)
}
fun test2() {
run<Unit>(block = local fun <anonymous>() {
return Unit
}
)
}
fun test3() {
run<Unit>(block = local fun <anonymous>() {
return run<Nothing>(block = local fun <anonymous>(): Nothing {
return Unit
}
)
}
)
}
fun testLrmFoo1(ints: List<Int>) {
ints.forEach<Int>(action = local fun <anonymous>(it: Int) {
when {
EQEQ(arg0 = it, arg1 = 0) -> return Unit
}
print(message = it)
}
)
}
fun testLrmFoo2(ints: List<Int>) {
ints.forEach<Int>(action = local fun <anonymous>(it: Int) {
when {
EQEQ(arg0 = it, arg1 = 0) -> return Unit
}
print(message = it)
}
)
}