[IR] add testdata for dumpKotlinLike

This commit is contained in:
Zalim Bashorov
2020-11-05 02:47:53 +03:00
committed by teamcityserver
parent d2022ab115
commit 8d5facb15f
365 changed files with 15516 additions and 0 deletions
@@ -0,0 +1,7 @@
val anonymous: Function0<Unit>
field = local fun <no name provided>() {
println()
}
get
@@ -0,0 +1,69 @@
data class A {
constructor(x: Int, y: Int) /* primary */ {
TODO("IrDelegatingConstructorCall")
/* InstanceInitializerCall */
}
val x: Int
field = x
get
val y: Int
field = y
get
operator fun component1(): Int {
return #x
}
operator fun component2(): Int {
return #y
}
fun copy(x: Int = #x, y: Int = #y): A {
return TODO("IrConstructorCall")
}
override fun toString(): String {
return "A(" +
"x=" +
#x +
", " +
"y=" +
#y +
")"
}
override fun hashCode(): Int {
return #x.hashCode().times(other = 31).plus(other = #y.hashCode())
}
override operator 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 = #x, arg1 = #x).not() -> return false
}
when {
EQEQ(arg0 = #y, arg1 = #y).not() -> return false
}
return true
}
}
var fn: Function1<A, Int>
field = local fun <anonymous>(<name for destructuring parameter 0>: A): Int {
val y: Int = <name for destructuring parameter 0>.component2()
return 42.plus(other = y)
}
get
set
@@ -0,0 +1,7 @@
fun test1(): Int {
return run<String, Int>($receiver = "42", block = local fun String.<anonymous>(): Int {
return <this>.<get-length>()
}
)
}
+14
View File
@@ -0,0 +1,14 @@
val test1: Function0<Int>
field = local fun <anonymous>(): Int {
return 42
}
get
val test2: Function0<Unit>
field = local fun <anonymous>() {
return Unit
}
get
@@ -0,0 +1,14 @@
fun outer() {
var x: Int = 0
local fun local() {
{ //BLOCK
val tmp0: Int = x
x = tmp0.inc()
tmp0
} /*~> Unit */
}
local()
}
@@ -0,0 +1,58 @@
object A {
private constructor() /* primary */ {
TODO("IrDelegatingConstructorCall")
/* InstanceInitializerCall */
}
}
object B {
private constructor() /* primary */ {
TODO("IrDelegatingConstructorCall")
/* InstanceInitializerCall */
}
}
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>.invoke($receiver = <this>.<get-foo>($receiver = <this>))
}
)
}
)
}
) /*~> Unit */
}
@@ -0,0 +1,51 @@
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>() {
run<Nothing>(block = local fun <anonymous>(): Nothing {
return Unit
}
)
}
)
}
fun testLrmFoo1(ints: List<Int>) {
forEach<Int>($receiver = ints, action = local fun <anonymous>(it: Int) {
when {
EQEQ(arg0 = it, arg1 = 0) -> return Unit
}
print(message = it)
}
)
}
fun testLrmFoo2(ints: List<Int>) {
forEach<Int>($receiver = ints, action = local fun <anonymous>(it: Int) {
when {
EQEQ(arg0 = it, arg1 = 0) -> return Unit
}
print(message = it)
}
)
}
+8
View File
@@ -0,0 +1,8 @@
fun test1() {
val hello: Runnable = local fun <anonymous>() {
println(message = "Hello, world!")
}
/*-> Runnable */
hello.run()
}