[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,68 @@
fun test(fn: Function0<Unit>, r: Runnable, arr: Array<String>) {
error("") /* ERROR CALL */local fun <anonymous>() {
return Unit
}
; arr;
foo1(r = local fun <anonymous>() {
return Unit
}
/*-> Runnable? */, strs = [*arr]) /*~> Unit */
error("") /* ERROR CALL */fn; arr;
foo1(r = fn /*-> Runnable? */, strs = [*arr]) /*~> Unit */
foo1(r = r, strs = [""]) /*~> Unit */
error("") /* ERROR CALL */fn; arr;
foo1(r = fn /*-> Runnable? */, strs = [*arr]) /*~> Unit */
foo1(r = r, strs = [*arr]) /*~> Unit */
val i1: ErrorType /* ERROR */ = error("") /* ERROR CALL */local fun <anonymous>() {
return Unit
}
; arr;
val i2: Test = Test(r = local fun <anonymous>() {
return Unit
}
/*-> Runnable? */, strs = [*arr])
val i3: ErrorType /* ERROR */ = error("") /* ERROR CALL */local fun <anonymous>() {
return Unit
}
; local fun <anonymous>() {
return Unit
}
; arr;
val i4: Test = Test(r1 = r, r2 = local fun <anonymous>() {
return Unit
}
/*-> Runnable? */, strs = [""])
val i5: Test = Test(r1 = local fun <anonymous>() {
return Unit
}
/*-> Runnable? */, r2 = local fun <anonymous>() {
return Unit
}
/*-> Runnable? */, strs = [*arr])
val i6: Test = Test(r1 = r, r2 = local fun <anonymous>() {
return Unit
}
/*-> Runnable? */, strs = [*arr])
error("") /* ERROR CALL */local fun <anonymous>() {
return Unit
}
; local fun <anonymous>() {
return Unit
}
; arr;
error("") /* ERROR CALL */r; local fun <anonymous>() {
return Unit
}
; "";
error("") /* ERROR CALL */local fun <anonymous>() {
return Unit
}
; local fun <anonymous>() {
return Unit
}
; arr;
error("") /* ERROR CALL */r; local fun <anonymous>() {
return Unit
}
; arr;
}
@@ -0,0 +1,14 @@
fun test(a: SomeJavaClass<out String>) {
a.someFunction(hello = local fun <anonymous>(it: String?) {
return Unit
}
/*-> Hello<Any?>? */)
a.plus(hello = local fun <anonymous>(it: String?) {
return Unit
}
/*-> Hello<Any?>? */)
a.get(hello = local fun <anonymous>(it: String?) {
return Unit
}
/*-> Hello<Any?>? */)
}
@@ -0,0 +1,9 @@
fun f(x: Any): String {
when {
x is A<*> -> return x /*as A<*> */.call(block = local fun <anonymous>(y: Any?): String? {
return "OK"
}
/*-> I<Any?>? */) /*!! String */
}
return "Fail"
}
@@ -0,0 +1,6 @@
fun test1() {
bar(j = local fun <anonymous>(x: Any): Any? {
return x
}
/*-> J<*>? */)
}
@@ -0,0 +1,24 @@
fun test1(): Runnable {
return local fun <anonymous>() {
return Unit
}
/*-> Runnable */
}
fun test2(a: Function0<Unit>): Runnable {
return a /*-> Runnable */
}
fun foo() {
}
fun test3(): Runnable {
return ::foo /*-> Runnable */
}
fun test4(): Comparator<Int?> {
return local fun <anonymous>(a: Int?, b: Int?): Int {
return a.minus(other = b /*!! Int */)
}
/*-> Comparator<Int?> */
}
@@ -0,0 +1,8 @@
fun test1(f: Function1<String, String>): C<String?> {
return C<String?>(jxx = f /*-> J<X?, X?>? */)
}
fun test2(x: Any) {
x as Function1<String, String> /*~> Unit */
C<String?>(jxx = x /*as Function1<String, String> */ /*-> J<X?, X?>? */) /*~> Unit */
}
@@ -0,0 +1,42 @@
fun test3(f1: Function1<String, String>, f2: Function1<Int, String>): D<Int?, String?> {
return C<String?>(jxx = f1 /*-> J<X?, X?>? */).D<Int?>(jxy = f2 /*-> J<String?, Y?>? */)
}
class Outer<T1 : Any?> {
constructor(j11: J<T1, T1>) /* primary */ {
super/*Any*/()
/* <init>() */
}
val j11: J<T1, T1>
field = j11
get
inner class Inner<T2 : Any?> {
constructor(j12: J<T1, T2>) /* primary */ {
super/*Any*/()
/* <init>() */
}
val j12: J<T1, T2>
field = j12
get
}
}
fun test4(f: Function1<String, String>, g: Function1<Any, String>): Inner<Any?, String?> {
return Outer<String?>(j11 = f /*-> J<T1, T1> */).Inner<Any?>(j12 = g /*-> J<String?, T2> */)
}
fun testGenericJavaCtor1(f: Function1<String, Int>): G<String?> {
return G<String?, Int?>(x = f /*-> J<TCtor?, TClass?>? */)
}
fun testGenericJavaCtor2(x: Any) {
x as Function1<String, Int> /*~> Unit */
G<String?, Int?>(x = x /*as Function1<String, Int> */ /*-> J<TCtor?, TClass?>? */) /*~> Unit */
}
@@ -0,0 +1,51 @@
fun test1(): J<String?> {
return local fun <anonymous>(x: String?): String? {
return x
}
/*-> J<String?> */
}
fun test2(): J<String?> {
return local fun <anonymous>(x: String): String {
return x
}
/*-> J<String?> */
}
fun test3() {
return bar<String?>(j = local fun <anonymous>(x: String): String {
return x
}
/*-> J<X?>? */)
}
fun test4(a: Any) {
a as J<String> /*~> Unit */
bar<String?>(j = a /*as J<String> */)
}
fun test5(a: Any) {
a as Function1<String, String> /*~> Unit */
bar<String?>(j = a /*as Function1<String, String> */ /*-> J<X?>? */)
}
fun <T : Any?> test6(a: Function1<T, T>) {
bar<T?>(j = a /*-> J<X?>? */)
}
fun <T : Any?> test7(a: Any) {
a as Function1<T, T> /*~> Unit */
bar<T?>(j = a /*as Function1<T, T> */ /*-> J<X?>? */)
}
fun test8(efn: @ExtensionFunctionType @ExtensionFunctionType Function1<String, String>): J<String?> {
return efn /*-> J<String?> */
}
fun test9(efn: @ExtensionFunctionType @ExtensionFunctionType Function1<String, String>) {
bar<String?>(j = efn /*-> J<X?>? */)
}
fun test10(fn: Function1<Int, String>) {
bar2x<Int?>(j2x = fn /*-> J2X<Y?>? */)
}
@@ -0,0 +1,29 @@
fun J.test0(a: Runnable) {
runStatic(r = a)
<this>.runIt(r = a)
}
fun test1() {
runStatic(r = local fun <anonymous>() {
test1()
}
/*-> Runnable? */)
}
fun J.test2() {
<this>.runIt(r = local fun <anonymous>() {
test1()
}
/*-> Runnable? */)
}
fun J.test3(a: Function0<Unit>) {
<this>.run2(r1 = a /*-> Runnable? */, r2 = a /*-> Runnable? */)
}
fun J.test4(a: Function0<Unit>, b: Function0<Unit>, flag: Boolean) {
<this>.runIt(r = when {
flag -> a
else -> b
} /*-> Runnable? */)
}
@@ -0,0 +1,56 @@
fun test1(a: Function0<Unit>) {
when {
a is Runnable -> runStatic(r = a /*as Runnable */)
}
}
fun test2(a: Function0<Unit>) {
when {
a is Runnable -> J().run1(r = a /*as Runnable */)
}
}
fun test3(a: Function0<Unit>) {
when {
a is Runnable -> J().run2(r1 = a /*as Runnable */, r2 = a /*as Runnable */)
}
}
fun test4(a: Function0<Unit>, b: Function0<Unit>) {
when {
a is Runnable -> J().run2(r1 = a /*as Runnable */, r2 = b /*-> Runnable? */)
}
}
fun test5(a: Any) {
when {
a is Runnable -> J().run1(r = a /*as Runnable */)
}
}
fun test5x(a: Any) {
when {
a is Runnable -> { // BLOCK
a /*as Runnable */ as Function0<Unit> /*~> Unit */
J().run1(r = a /*as Runnable */)
}
}
}
fun test6(a: Any) {
a as Function0<Unit> /*~> Unit */
J().run1(r = a /*as Function0<Unit> */ /*-> Runnable? */)
}
fun test7(a: Function1<Int, Int>) {
a as Function0<Unit> /*~> Unit */
error("") /* ERROR CALL */a /*as Function0<Unit> */;
}
fun test8(a: Function0<Unit>) {
error("") /* ERROR CALL */id<Function0<Unit>?>(x = a);
}
fun test9() {
J().run1(r = ::test9 /*-> Runnable? */)
}
@@ -0,0 +1,17 @@
fun f() {
}
fun J.test1() {
<this>.get(k = ::f /*-> Runnable? */)
<this>.get(k = ::f /*-> Runnable? */, m = ::f /*-> Runnable? */)
}
fun J.test2() {
<this>.set(k = ::f /*-> Runnable? */, v = ::f /*-> Runnable? */)
<this>.set(k = ::f /*-> Runnable? */, m = ::f /*-> Runnable? */, v = ::f /*-> Runnable? */)
}
fun J.test3() {
<this>.plusAssign(i = ::f /*-> Runnable? */)
<this>.minusAssign(i = ::f /*-> Runnable? */)
}