[FIR] Fix translation of invokes & add return expressions for lambdas

* fixed NoSuchMethod caused by mismatched signatures of the "invoke" method generated for lambda arguments
* added test cases in invoke.kt for KFunction and anonymous functions
* added a transformer to wrap the last expression in the bodies of lambdas with return
This commit is contained in:
Juan Chen
2020-02-01 18:18:03 -08:00
committed by Mikhail Glukhikh
parent 5eedba3903
commit 7249d2f889
194 changed files with 397 additions and 506 deletions
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS
// reason - no error from division by zero in JS
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
private fun <T> upcast(value: T): T = value
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun foo(): String = "foo1"
fun foo(i: Int): String = "foo2"
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
val foo: () -> Unit = {}
fun box(): String {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class MyClass(var fnc : () -> String) {
fun test(): String {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class T(val f : () -> Any?) {
fun call() : Any? = f()
}
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Foo(
var state : Int,
val f : (Int) -> Int){
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
open class Base(val fn: () -> String)
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
open class Base(val fn1: () -> String, val fn2: () -> String)
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun box() : String {
return apply( "OK", {arg: String -> arg } )
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun box() : String {
return if (apply( 5, {arg: Int -> arg + 13 } ) == 18) "OK" else "fail"
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun box() : String {
val cl = 39
return if (sum(200, { val ff = {cl}; ff() }) == 239) "OK" else "FAIL"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun box() : String {
val cl = 39
return if (sum(200, { val m = { val r = { cl }; r() }; m() }) == 239) "OK" else "FAIL"
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
open class A(val s: Int) {
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun box(): String {
val o = "O"
val ok_L = {o + "K"}
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun box(): String {
val a = 1
val explicitlyReturned = run1 f@{
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun box(): String {
val a = 1
val explicitlyReturned = run1 {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun box() : String {
return invoker( {"OK"} )
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun box() : String {
return if (int_invoker( { 7 } ) == 7) "OK" else "fail"
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun foo(block: (String, String, String) -> String): String = block("O", "fail", "K")
fun box() = foo { x, _, y -> x + y }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS
// reason - no error from division by zero in JS
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
private const val z = "OK";
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun zap(s: String): String? = s
inline fun tryZap(s: String, fn: (String) -> String): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
inline fun catchAll(x: String, block: () -> Unit): String {
try {
block()
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
inline fun <T> tryOrElse(f1: () -> T, f2: () -> T): T {
try {
return f1()
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
inline fun <T> tryOrElse(f1: () -> T, f2: () -> T): T =
try { f1() } catch (e: Exception) { f2() }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
inline fun <T> tryAndThen(f1: () -> Unit, f2: () -> Unit, f3: () -> T): T {
try {
f1()
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun zap(s: String) = s
inline fun tryZap(string: String, fn: (String) -> String) =
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun zap(s: String) = s
inline fun tryZap(s1: String, s2: String, fn: (String, String) -> String) =
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun zap(s: String) = s
inline fun tryZap(string: String, fn: (String) -> String) =
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun zap(s: String) = s
inline fun tryZap(string: String, fn: (String) -> String) =
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun zap(s: String) = s
inline fun tryZap1(string: String, fn: (String) -> String) =
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
inline fun test(s: () -> Int): Int =
try {
val i = s()
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
import kotlin.test.*
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val x: String, val y: String)
inline fun foo(a: A, block: (A) -> String): String = block(a)
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val x: String, val y: String)
fun foo(a: A, block: (Int, A, String) -> String): String = block(1, a, "#")
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val x: String, val y: String)
fun foo(a: A, block: (A) -> String): String = block(a)
@@ -1,5 +1,4 @@
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
// IGNORE_BACKEND_FIR: JVM_IR
fun <R> foo(f: () -> R): R = f()
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
//KT-1249 IllegalStateException invoking function property
class TestClass(val body : () -> Unit) : Any() {
fun run() {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
infix fun <T> T.mustBe(t : T) {
assert("$this must be $t") {this == t}
}
@@ -1,5 +1,4 @@
// !LANGUAGE: +FunctionTypesWithBigArity
// IGNORE_BACKEND_FIR: JVM_IR
class A(val value: Int)
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun foo(block: (String, String, String) -> String): String = block("O", "fail", "K")
fun box() = foo(fun(x: String, _: String, y: String) = x + y)
+4 -2
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package invoke
fun test1(predicate: (Int) -> Int, i: Int) = predicate(i)
@@ -24,6 +23,9 @@ fun box() : String {
if (test2({ it }, 2) != 2) return "fail 2"
if (test3(Method(), 3) != 3) return "fail 3"
if (test4(Method(), 4) != 4) return "fail 4"
if (test5(Method2(), "s") != "s") return "fail5"
if (test5(Method2(), "s") != "s") return "fail 5"
if (test1(Int::dec, 1) != 0) return "fail 6"
if (test2(Int::dec, 1) != 0) return "fail 7"
if (test1(fun(x: Int) = x - 1, 1) != 0) return "fail 8"
return "OK"
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
//KT-3217 Invoke convention after function invocation doesn't work
//KT-2728 Can't compile A()()
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
//KT-3189 Function invoke is called with no reason
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
//KT-3297 Calling the wrong function inside an extension method to the Function0 class
infix fun <R> Function0<R>.or(alt: () -> R): R {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun foo(x: Int) {}
fun loop(times : Int) {
@@ -1,5 +1,4 @@
// !LANGUAGE: +NewInference
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
inline fun <T> foo(f: () -> T): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun foo() : String {
val u = {
class B(val data : String)
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A {
operator fun component1() = 1
operator fun component2() = 2
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Range(val from : C, val to: C) {
operator fun iterator() = It(from, to)
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Range(val from : C, val to: C) {
operator fun iterator() = It(from, to)
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
operator fun Int.component1() = this + 1
operator fun Int.component2() = this + 2
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
operator fun Long.component1() = this + 1
operator fun Long.component2() = this + 2
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Range(val from : C, val to: C) {
operator fun iterator() = It(from, to)
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
operator fun Int.component1() = this + 1
operator fun Int.component2() = this + 2
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
operator fun Long.component1() = this + 1
operator fun Long.component2() = this + 2
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
operator fun Int.component1() = this + 1
operator fun Int.component2() = this + 2
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
operator fun Long.component1() = this + 1
operator fun Long.component2() = this + 2
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FILE: box.kt
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// IGNORE_LIGHT_ANALYSIS
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun box(): String {
defineFunc<String>()
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
abstract class Base(val fn: () -> String)
object Test : Base({ Test.ok() }) {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
private var x = "O"
private fun f() = "K"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
var order: String = ""
fun a(i: Int): Int? {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
val my: String = "O"
get() = { field }() + "K"
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
val Int.ext: () -> Int get() = { 5 }
val Long.ext: Long get() = 4.ext().toLong() //(c.kt:4)
val y: Long get() = 10L.ext
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun runNoInline(f: () -> Unit) = f()
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package test
private val prop = "O"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun isNull(x: Unit?) = x == null
fun box(): String {
@@ -1,5 +1,4 @@
// !LANGUAGE: +VariableDeclarationInWhenSubject
// IGNORE_BACKEND_FIR: JVM_IR
fun box(): String {
var y: String = "OK"
@@ -25,7 +25,8 @@ FILE fqName:<root> fileName:/delegateFieldWithAnnotations.kt
initializer: FUN_EXPR type=kotlin.Function0<kotlin.Int> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY
CONST Int type=kotlin.Int value=42
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Int declared in <root>.test1$delegate'
CONST Int type=kotlin.Int value=42
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test1> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [delegated,val]
BLOCK_BODY
@@ -91,7 +91,8 @@ FILE fqName:<root> fileName:/classLevelProperties.kt
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($this:<root>.C) returnType:kotlin.Int
$this: VALUE_PARAMETER name:<this> type:<root>.C
BLOCK_BODY
CONST Int type=kotlin.Int value=42
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Int declared in <root>.C.test7$delegate'
CONST Int type=kotlin.Int value=42
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test7> visibility:public modality:FINAL <> ($this:<root>.C) returnType:kotlin.Int
correspondingProperty: PROPERTY name:test7 visibility:public modality:FINAL [delegated,val]
$this: VALUE_PARAMETER name:<this> type:<root>.C
@@ -7,7 +7,8 @@ FILE fqName:<root> fileName:/delegatedProperties.kt
initializer: FUN_EXPR type=kotlin.Function0<kotlin.Int> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY
CONST Int type=kotlin.Int value=42
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Int declared in <root>.test1$delegate'
CONST Int type=kotlin.Int value=42
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test1> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [delegated,val]
BLOCK_BODY
@@ -44,7 +45,8 @@ FILE fqName:<root> fileName:/delegatedProperties.kt
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($this:<root>.C) returnType:kotlin.Int
$this: VALUE_PARAMETER name:<this> type:<root>.C
BLOCK_BODY
CONST Int type=kotlin.Int value=42
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Int declared in <root>.C.test2$delegate'
CONST Int type=kotlin.Int value=42
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test2> visibility:public modality:FINAL <> ($this:<root>.C) returnType:kotlin.Int
correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [delegated,val]
$this: VALUE_PARAMETER name:<this> type:<root>.C
@@ -70,7 +70,8 @@ FILE fqName:<root> fileName:/packageLevelProperties.kt
initializer: FUN_EXPR type=kotlin.Function0<kotlin.Int> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY
CONST Int type=kotlin.Int value=42
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Int declared in <root>.test7$delegate'
CONST Int type=kotlin.Int value=42
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test7> visibility:public modality:FINAL <> () returnType:kotlin.Int
correspondingProperty: PROPERTY name:test7 visibility:public modality:FINAL [delegated,val]
BLOCK_BODY
@@ -6,7 +6,8 @@ FILE fqName:<root> fileName:/lambdas.kt
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.String) returnType:kotlin.String
VALUE_PARAMETER name:it index:0 type:kotlin.String
BLOCK_BODY
GET_VAR 'it: kotlin.String declared in <root>.test1.<anonymous>' type=kotlin.String origin=null
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: kotlin.String): kotlin.String declared in <root>.test1'
GET_VAR 'it: kotlin.String declared in <root>.test1.<anonymous>' type=kotlin.String origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test1> visibility:public modality:FINAL <> () returnType:kotlin.Function1<kotlin.String, kotlin.String>
correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -20,8 +21,9 @@ FILE fqName:<root> fileName:/lambdas.kt
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:it index:0 type:kotlin.Any
BLOCK_BODY
CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null
$this: GET_VAR 'it: kotlin.Any declared in <root>.test2.<anonymous>' type=kotlin.Any origin=null
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: kotlin.Any): kotlin.Int declared in <root>.test2'
CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null
$this: GET_VAR 'it: kotlin.Any declared in <root>.test2.<anonymous>' type=kotlin.Any origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test2> visibility:public modality:FINAL <> () returnType:kotlin.Function2<kotlin.Any, kotlin.Any, kotlin.Any>
correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -5,16 +5,18 @@ FILE fqName:<root> fileName:/useNextParamInLambda.kt
FUN_EXPR type=kotlin.Function0<IrErrorType> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:IrErrorType
BLOCK_BODY
ERROR_CALL 'Unresolved reference: <Unresolved name: f2>#' type=IrErrorType
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): IrErrorType declared in <root>.f'
ERROR_CALL 'Unresolved reference: <Unresolved name: f2>#' type=IrErrorType
VALUE_PARAMETER name:f2 index:1 type:kotlin.Function0<kotlin.String>
EXPRESSION_BODY
FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
CONST String type=kotlin.String value="FAIL"
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.f'
CONST String type=kotlin.String value="FAIL"
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun f (f1: kotlin.Function0<kotlin.String>, f2: kotlin.Function0<kotlin.String>): kotlin.String declared in <root>'
CALL 'public abstract fun invoke (): kotlin.String [operator] declared in kotlin.Function0' type=kotlin.String origin=null
CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=kotlin.String origin=INVOKE
$this: GET_VAR 'f1: kotlin.Function0<kotlin.String> declared in <root>.f' type=kotlin.Function0<kotlin.String> origin=null
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
@@ -33,9 +35,11 @@ FILE fqName:<root> fileName:/useNextParamInLambda.kt
f1: FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
CONST String type=kotlin.String value="O"
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.box'
CONST String type=kotlin.String value="O"
other: CALL 'public final fun f (f1: kotlin.Function0<kotlin.String>, f2: kotlin.Function0<kotlin.String>): kotlin.String declared in <root>' type=kotlin.String origin=null
f1: FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
CONST String type=kotlin.String value="K"
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.box'
CONST String type=kotlin.String value="K"
@@ -47,6 +47,6 @@ FILE fqName:<root> fileName:/augmentedAssignmentWithExpression.kt
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<<root>.Host>
BLOCK_BODY
CALL 'public final fun plusAssign (x: kotlin.Int): kotlin.Unit [operator] declared in <root>.Host' type=kotlin.Unit origin=null
$this: CALL 'public abstract fun invoke (): <root>.Host [operator] declared in kotlin.Function0' type=<root>.Host origin=null
$this: CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=<root>.Host origin=INVOKE
$this: GET_VAR 'a: kotlin.Function0<<root>.Host> declared in <root>.test4' type=kotlin.Function0<<root>.Host> origin=null
x: CONST Int type=kotlin.Int value=1
@@ -8,7 +8,8 @@ FILE fqName:<root> fileName:/breakContinueInWhen.kt
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (i:kotlin.Int) returnType:kotlin.Int
VALUE_PARAMETER name:i index:0 type:kotlin.Int
BLOCK_BODY
GET_VAR 'i: kotlin.Int declared in <root>.testBreakFor.<anonymous>' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='local final fun <anonymous> (i: kotlin.Int): kotlin.Int declared in <root>.testBreakFor'
GET_VAR 'i: kotlin.Int declared in <root>.testBreakFor.<anonymous>' type=kotlin.Int origin=null
VAR name:k type:kotlin.Int [var]
CONST Int type=kotlin.Int value=0
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.IntArray [val]
@@ -66,7 +67,8 @@ FILE fqName:<root> fileName:/breakContinueInWhen.kt
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (i:kotlin.Int) returnType:kotlin.Int
VALUE_PARAMETER name:i index:0 type:kotlin.Int
BLOCK_BODY
GET_VAR 'i: kotlin.Int declared in <root>.testContinueFor.<anonymous>' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='local final fun <anonymous> (i: kotlin.Int): kotlin.Int declared in <root>.testContinueFor'
GET_VAR 'i: kotlin.Int declared in <root>.testContinueFor.<anonymous>' type=kotlin.Int origin=null
VAR name:k type:kotlin.Int [var]
CONST Int type=kotlin.Int value=0
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.IntArray [val]
@@ -71,7 +71,7 @@ FILE fqName:test fileName:/boundInnerGenericConstructor.kt
VALUE_PARAMETER name:x index:2 type:kotlin.Function2<A of test.foo, B of test.foo, test.Foo.Inner<A of test.foo, B of test.foo>>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun foo <A, B> (a: A of test.foo, b: B of test.foo, x: kotlin.Function2<A of test.foo, B of test.foo, test.Foo.Inner<A of test.foo, B of test.foo>>): test.Foo.Inner<A of test.foo, B of test.foo> [inline] declared in test'
CALL 'public abstract fun invoke (p1: A of test.foo, p2: B of test.foo): test.Foo.Inner<A of test.foo, B of test.foo> [operator] declared in kotlin.Function2' type=test.Foo.Inner<A of test.foo, B of test.foo> origin=null
CALL 'public abstract fun invoke (p1: P1 of kotlin.Function2, p2: P2 of kotlin.Function2): R of kotlin.Function2 [operator] declared in kotlin.Function2' type=test.Foo.Inner<A of test.foo, B of test.foo> origin=INVOKE
$this: GET_VAR 'x: kotlin.Function2<A of test.foo, B of test.foo, test.Foo.Inner<A of test.foo, B of test.foo>> declared in test.foo' type=kotlin.Function2<A of test.foo, B of test.foo, test.Foo.Inner<A of test.foo, B of test.foo>> origin=null
p1: GET_VAR 'a: A of test.foo declared in test.foo' type=A of test.foo origin=null
p2: GET_VAR 'b: B of test.foo declared in test.foo' type=B of test.foo origin=null
@@ -3,7 +3,7 @@ FILE fqName:<root> fileName:/constructorWithAdaptedArguments.kt
VALUE_PARAMETER name:fn index:0 type:kotlin.Function1<kotlin.Int, kotlin.Any>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun use (fn: kotlin.Function1<kotlin.Int, kotlin.Any>): kotlin.Any declared in <root>'
CALL 'public abstract fun invoke (p1: kotlin.Int): kotlin.Any [operator] declared in kotlin.Function1' type=kotlin.Any origin=null
CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.Any origin=INVOKE
$this: GET_VAR 'fn: kotlin.Function1<kotlin.Int, kotlin.Any> declared in <root>.use' type=kotlin.Function1<kotlin.Int, kotlin.Any> origin=null
p1: CONST Int type=kotlin.Int value=42
CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any]
@@ -3,7 +3,7 @@ FILE fqName:<root> fileName:/withAdaptedArguments.kt
VALUE_PARAMETER name:fn index:0 type:kotlin.Function1<kotlin.Int, kotlin.String>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun use (fn: kotlin.Function1<kotlin.Int, kotlin.String>): kotlin.String declared in <root>'
CALL 'public abstract fun invoke (p1: kotlin.Int): kotlin.String [operator] declared in kotlin.Function1' type=kotlin.String origin=null
CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.String origin=INVOKE
$this: GET_VAR 'fn: kotlin.Function1<kotlin.Int, kotlin.String> declared in <root>.use' type=kotlin.Function1<kotlin.Int, kotlin.String> origin=null
p1: CONST Int type=kotlin.Int value=1
FUN name:coerceToUnit visibility:public modality:FINAL <> (fn:kotlin.Function1<kotlin.Int, kotlin.Unit>) returnType:kotlin.Unit
@@ -2,7 +2,7 @@ FILE fqName:<root> fileName:/withArgumentAdaptationAndReceiver.kt
FUN name:use visibility:public modality:FINAL <> (fn:kotlin.Function1<kotlin.Int, kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:fn index:0 type:kotlin.Function1<kotlin.Int, kotlin.Unit>
BLOCK_BODY
CALL 'public abstract fun invoke (p1: kotlin.Int): kotlin.Unit [operator] declared in kotlin.Function1' type=kotlin.Unit origin=null
CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.Unit origin=INVOKE
$this: GET_VAR 'fn: kotlin.Function1<kotlin.Int, kotlin.Unit> declared in <root>.use' type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=null
p1: CONST Int type=kotlin.Int value=1
CLASS CLASS name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]
@@ -36,10 +36,11 @@ FILE fqName:<root> fileName:/withVarargViewedAsArray.kt
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.Int) returnType:kotlin.Int
VALUE_PARAMETER name:it index:0 type:kotlin.Int
BLOCK_BODY
CALL 'public abstract fun toInt (): kotlin.Int declared in kotlin.Number' type=kotlin.Int origin=null
$this: CALL 'public final fun get (index: kotlin.Int): kotlin.Number [operator] declared in kotlin.Array' type=kotlin.Number origin=null
$this: GET_VAR 'args: kotlin.Array<kotlin.Number> [vararg] declared in <root>.nsum' type=kotlin.Array<kotlin.Number> origin=null
index: GET_VAR 'it: kotlin.Int declared in <root>.nsum.<anonymous>' type=kotlin.Int origin=null
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: kotlin.Int): kotlin.Int declared in <root>.nsum'
CALL 'public abstract fun toInt (): kotlin.Int declared in kotlin.Number' type=kotlin.Int origin=null
$this: CALL 'public final fun get (index: kotlin.Int): kotlin.Number [operator] declared in kotlin.Array' type=kotlin.Number origin=null
$this: GET_VAR 'args: kotlin.Array<kotlin.Number> [vararg] declared in <root>.nsum' type=kotlin.Array<kotlin.Number> origin=null
index: GET_VAR 'it: kotlin.Int declared in <root>.nsum.<anonymous>' type=kotlin.Int origin=null
FUN name:zap visibility:public modality:FINAL <> (b:kotlin.Array<kotlin.String>, k:kotlin.Int) returnType:kotlin.Unit
VALUE_PARAMETER name:b index:0 type:kotlin.Array<kotlin.String> varargElementType:kotlin.String [vararg]
VALUE_PARAMETER name:k index:1 type:kotlin.Int
@@ -4,7 +4,7 @@ FILE fqName:<root> fileName:/catchParameterAccess.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test (f: kotlin.Function0<kotlin.Unit>): kotlin.Unit declared in <root>'
TRY type=kotlin.Unit
try: CALL 'public abstract fun invoke (): kotlin.Unit [operator] declared in kotlin.Function0' type=kotlin.Unit origin=null
try: CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=kotlin.Unit origin=INVOKE
$this: GET_VAR 'f: kotlin.Function0<kotlin.Unit> declared in <root>.test' type=kotlin.Function0<kotlin.Unit> origin=null
CATCH parameter=val e: java.lang.Exception [val] declared in <root>.test
VAR name:e type:java.lang.Exception [val]
@@ -5,7 +5,8 @@ FILE fqName:<root> fileName:/coercionToUnit.kt
FUN_EXPR type=kotlin.Function0<kotlin.Int> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY
CONST Int type=kotlin.Int value=42
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Int declared in <root>.test1'
CONST Int type=kotlin.Int value=42
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test1> visibility:public modality:FINAL <> () returnType:kotlin.Function0<kotlin.Unit>
correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -30,8 +30,9 @@ FILE fqName:<root> fileName:/enumEntryAsReceiver.kt
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($this:<root>.X.B) returnType:kotlin.String
$this: VALUE_PARAMETER name:<this> type:<root>.X.B
BLOCK_BODY
CALL 'public final fun <get-value2> (): kotlin.String declared in <root>.X.B' type=kotlin.String origin=null
$this: GET_VAR '<this>: <uninitialized parent>.<anonymous> declared in <no parent>.<anonymous>' type=<uninitialized parent>.<anonymous> origin=null
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.X.B.value'
CALL 'public final fun <get-value2> (): kotlin.String declared in <root>.X.B' type=kotlin.String origin=null
$this: GET_VAR '<this>: <uninitialized parent>.<anonymous> declared in <no parent>.<anonymous>' type=<uninitialized parent>.<anonymous> origin=null
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-value> visibility:public modality:FINAL <> ($this:<root>.X.B) returnType:kotlin.Function0<kotlin.String>
correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.X.B
@@ -87,6 +88,6 @@ FILE fqName:<root> fileName:/enumEntryAsReceiver.kt
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
CALL 'public abstract fun invoke (): kotlin.String [operator] declared in kotlin.Function0' type=kotlin.String origin=null
CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=kotlin.String origin=INVOKE
$this: CALL 'public abstract fun <get-value> (): kotlin.Function0<kotlin.String> declared in <root>.X' type=kotlin.Function0<kotlin.String> origin=null
$this: GET_ENUM 'ENUM_ENTRY name:B' type=<root>.X
@@ -4,7 +4,7 @@ FILE fqName:<root> fileName:/extFunInvokeAsFun.kt
VALUE_PARAMETER name:block index:1 type:kotlin.Function1<kotlin.Any?, kotlin.Unit>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun with1 (receiver: kotlin.Any?, block: kotlin.Function1<kotlin.Any?, kotlin.Unit>): kotlin.Unit declared in <root>'
CALL 'public abstract fun invoke (p1: kotlin.Any?): kotlin.Unit [operator] declared in kotlin.Function1' type=kotlin.Unit origin=null
CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.Unit origin=INVOKE
$this: GET_VAR 'block: kotlin.Function1<kotlin.Any?, kotlin.Unit> declared in <root>.with1' type=kotlin.Function1<kotlin.Any?, kotlin.Unit> origin=null
p1: GET_VAR 'receiver: kotlin.Any? declared in <root>.with1' type=kotlin.Any? origin=null
FUN name:with2 visibility:public modality:FINAL <> (receiver:kotlin.Any?, block:kotlin.Function1<kotlin.Any?, kotlin.Unit>) returnType:kotlin.Unit
@@ -12,6 +12,6 @@ FILE fqName:<root> fileName:/extFunInvokeAsFun.kt
VALUE_PARAMETER name:block index:1 type:kotlin.Function1<kotlin.Any?, kotlin.Unit>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun with2 (receiver: kotlin.Any?, block: kotlin.Function1<kotlin.Any?, kotlin.Unit>): kotlin.Unit declared in <root>'
CALL 'public abstract fun invoke (p1: kotlin.Any?): kotlin.Unit [operator] declared in kotlin.Function1' type=kotlin.Unit origin=null
CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.Unit origin=INVOKE
$this: GET_VAR 'block: kotlin.Function1<kotlin.Any?, kotlin.Unit> declared in <root>.with2' type=kotlin.Function1<kotlin.Any?, kotlin.Unit> origin=null
p1: GET_VAR 'receiver: kotlin.Any? declared in <root>.with2' type=kotlin.Any? origin=null
@@ -29,4 +29,5 @@ FILE fqName:<root> fileName:/basicFunInterfaceConversion.kt
f: FUN_EXPR type=kotlin.Function0<kotlin.String> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
CONST String type=kotlin.String value="OK"
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.String declared in <root>.test'
CONST String type=kotlin.String value="OK"
@@ -115,7 +115,8 @@ FILE fqName:<root> fileName:/partialSam.kt
VALUE_PARAMETER name:i index:1 type:kotlin.Int
VALUE_PARAMETER name:ti index:2 type:kotlin.Int
BLOCK_BODY
CONST String type=kotlin.String value=""
RETURN type=kotlin.Nothing from='local final fun <anonymous> (s: kotlin.String, i: kotlin.Int, ti: kotlin.Int): kotlin.String declared in <root>.test'
CONST String type=kotlin.String value=""
CALL 'public final fun runConversion (f1: <root>.Fn<kotlin.String, kotlin.Int>, f2: <root>.Fn<kotlin.Int, kotlin.String>): kotlin.Int declared in <root>.J' type=kotlin.Int origin=null
$this: GET_VAR 'j: <root>.J declared in <root>.test' type=<root>.J origin=null
f1: FUN_EXPR type=kotlin.Function3<kotlin.String, kotlin.Int, kotlin.String, kotlin.Int> origin=LAMBDA
@@ -124,5 +125,6 @@ FILE fqName:<root> fileName:/partialSam.kt
VALUE_PARAMETER name:i index:1 type:kotlin.Int
VALUE_PARAMETER name:ts index:2 type:kotlin.String
BLOCK_BODY
CONST Int type=kotlin.Int value=1
RETURN type=kotlin.Nothing from='local final fun <anonymous> (s: kotlin.String, i: kotlin.Int, ts: kotlin.String): kotlin.Int declared in <root>.test'
CONST Int type=kotlin.Int value=1
f2: CALL 'public final fun <get-fis> (): <uninitialized parent>.<anonymous> declared in <root>' type=<uninitialized parent>.<anonymous> origin=null
@@ -20,8 +20,9 @@ FILE fqName:<root> fileName:/genericConstructorCallWithTypeArguments.kt
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:kotlin.Int) returnType:T of <root>.testArray
VALUE_PARAMETER name:it index:0 type:kotlin.Int
BLOCK_BODY
CALL 'public abstract fun invoke (): T of <root>.testArray [operator] declared in kotlin.Function0' type=T of <root>.testArray origin=null
$this: GET_VAR 'block: kotlin.Function0<T of <root>.testArray> [crossinline] declared in <root>.testArray' type=kotlin.Function0<T of <root>.testArray> origin=null
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: kotlin.Int): T of <root>.testArray declared in <root>.testArray'
CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=T of <root>.testArray origin=INVOKE
$this: GET_VAR 'block: kotlin.Function0<T of <root>.testArray> [crossinline] declared in <root>.testArray' type=kotlin.Function0<T of <root>.testArray> origin=null
CLASS CLASS name:Box modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Box
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]

Some files were not shown because too many files have changed in this diff Show More