FIR2IR: cache functions and their parents properly

This commit is contained in:
Mikhail Glukhikh
2020-03-03 19:26:15 +03:00
parent 940567b8bd
commit 0fee8a6946
31 changed files with 71 additions and 121 deletions
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Point(val x : Int, val y : Int)
fun box() : String {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A {
fun foo() {}
fun bar(f: A.() -> Unit = {}) {}
@@ -1,5 +1,4 @@
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: NATIVE
import kotlin.contracts.*
@@ -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 test1(f: (Int) -> Int) = f(1)
fun test2(f: Int.() -> Int) = 2.f()
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun test(cl: Int.() -> Int):Int = 11.cl()
class Foo {
@@ -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 box() : String {
val y = 12
val op = { x:Int -> (x + y).toString() }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// FULL_JDK
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun box(): String {
val f = fun (s: String): String = s
val g = f as String.() -> String
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
//KT-3450 get and invoke are not parsed in one expression
public class A(val s: String) {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Data
fun newInit(f: Data.() -> Data) = Data().f()
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Comment() {
var article = ""
}
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun Any.with(operation : Any.() -> Any) = operation().toString()
val f = { a : Int -> }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
object ExtProvider {
-1
View File
@@ -1,6 +1,5 @@
// !LANGUAGE: +NewInference
// !USE_EXPERIMENTAL: kotlin.Experimental
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// ISSUE: KT-35684
-1
View File
@@ -1,7 +1,6 @@
// !LANGUAGE: +NewInference
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_REFLECT
import kotlin.experimental.ExperimentalTypeInference
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A(val result: String)
fun a(body: A.() -> String): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME
// WITH_RUNTIME
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: Outer.kt
package another
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun f(b : Int.(Int)->Int) = 1?.b(1)
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun f(b : Long.(Long)->Long) = 1L?.b(2L)
fun box(): String {
@@ -12,4 +12,4 @@ FILE fqName:<root> fileName:/extensionLambda.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Int declared in <root>.test1'
CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: kotlin.String declared in special.<anonymous>' type=kotlin.String origin=null
$this: GET_VAR '<this>: kotlin.String declared in <root>.test1.<anonymous>' type=kotlin.String origin=null
@@ -113,7 +113,7 @@ FILE fqName:<root> fileName:/multipleImplicitReceivers.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Int declared in <root>.test.<anonymous>.<anonymous>'
CALL 'public open fun invoke (): kotlin.Int [operator] declared in <root>.IInvoke' type=kotlin.Int origin=null
$this: GET_VAR '<this>: <root>.IInvoke declared in special.<anonymous>' type=<root>.IInvoke origin=null
$this: GET_VAR '<this>: <root>.IInvoke declared in <root>.test.<anonymous>.<anonymous>.<anonymous>' type=<root>.IInvoke origin=null
$receiver: CALL 'public open fun <get-foo> (): <root>.B declared in <root>.IFoo' type=<root>.B origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.IFoo declared in special.<anonymous>' type=<root>.IFoo origin=null
$receiver: GET_VAR '<this>: <root>.A declared in special.<anonymous>' type=<root>.A origin=null
$this: GET_VAR '<this>: <root>.IFoo declared in <root>.test.<anonymous>.<anonymous>' type=<root>.IFoo origin=null
$receiver: GET_VAR '<this>: <root>.A declared in <root>.test.<anonymous>' type=<root>.A origin=null
+1 -1
View File
@@ -28,7 +28,7 @@ FILE fqName:<root> fileName:/builtinMap.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.plus'
CALL 'public open fun put (p0: K of java.util.LinkedHashMap?, p1: V of java.util.LinkedHashMap?): V of java.util.LinkedHashMap? declared in java.util.LinkedHashMap' type=V1 of <root>.plus? origin=null
$this: GET_VAR '<this>: java.util.LinkedHashMap<K1 of <root>.plus?, V1 of <root>.plus?> declared in special.<anonymous>' type=java.util.LinkedHashMap<K1 of <root>.plus?, V1 of <root>.plus?> origin=null
$this: GET_VAR '<this>: java.util.LinkedHashMap<K1 of <root>.plus?, V1 of <root>.plus?> declared in <root>.plus.<anonymous>' type=java.util.LinkedHashMap<K1 of <root>.plus?, V1 of <root>.plus?> origin=null
p0: CALL 'public final fun <get-first> (): A of kotlin.Pair declared in kotlin.Pair' type=K1 of <root>.plus origin=GET_PROPERTY
$this: GET_VAR 'pair: kotlin.Pair<K1 of <root>.plus, V1 of <root>.plus> declared in <root>.plus' type=kotlin.Pair<K1 of <root>.plus, V1 of <root>.plus> origin=null
p1: CALL 'public final fun <get-second> (): B of kotlin.Pair declared in kotlin.Pair' type=V1 of <root>.plus origin=GET_PROPERTY
@@ -11,7 +11,7 @@ FILE fqName:<root> fileName:/castsInsideCoroutineInference.kt
$receiver: VALUE_PARAMETER name:<this> type:<root>.FlowCollector<R of <root>.scopedFlow>
BLOCK_BODY
VAR name:collector type:<root>.FlowCollector<R of <root>.scopedFlow> [val]
GET_VAR '<this>: <root>.FlowCollector<R of <root>.scopedFlow> declared in special.<anonymous>' type=<root>.FlowCollector<R of <root>.scopedFlow> origin=null
GET_VAR '<this>: <root>.FlowCollector<R of <root>.scopedFlow> declared in <root>.scopedFlow.<anonymous>' type=<root>.FlowCollector<R of <root>.scopedFlow> origin=null
CALL 'public final fun flowScope <R> (block: kotlin.Function1<<root>.CoroutineScope, R of <root>.flowScope>): R of <root>.flowScope [suspend] declared in <root>' type=kotlin.Unit origin=null
<R>: kotlin.Unit
block: FUN_EXPR type=kotlin.Function1<<root>.CoroutineScope, kotlin.Unit> origin=LAMBDA
@@ -20,7 +20,7 @@ FILE fqName:<root> fileName:/castsInsideCoroutineInference.kt
BLOCK_BODY
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=kotlin.Unit origin=INVOKE
$this: GET_VAR 'block: kotlin.Function2<<root>.CoroutineScope, <root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit> declared in <root>.scopedFlow' type=kotlin.Function2<<root>.CoroutineScope, <root>.FlowCollector<R of <root>.scopedFlow>, kotlin.Unit> origin=null
p1: GET_VAR '<this>: <root>.CoroutineScope declared in special.<anonymous>' type=<root>.CoroutineScope origin=null
p1: GET_VAR '<this>: <root>.CoroutineScope declared in <root>.scopedFlow.<anonymous>.<anonymous>' type=<root>.CoroutineScope origin=null
p2: GET_VAR 'val collector: <root>.FlowCollector<R of <root>.scopedFlow> [val] declared in <root>.scopedFlow.<anonymous>' type=<root>.FlowCollector<R of <root>.scopedFlow> origin=null
FUN name:onCompletion visibility:public modality:FINAL <T> ($receiver:<root>.Flow<T of <root>.onCompletion>, action:kotlin.Function2<<root>.FlowCollector<T of <root>.onCompletion>, kotlin.Throwable?, kotlin.Unit>) returnType:<root>.Flow<T of <root>.onCompletion>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
@@ -37,7 +37,7 @@ FILE fqName:<root> fileName:/castsInsideCoroutineInference.kt
VAR name:safeCollector type:<root>.SafeCollector<T of <root>.onCompletion> [val]
CONSTRUCTOR_CALL 'public constructor <init> (collector: <root>.FlowCollector<T of <root>.SafeCollector>) [primary] declared in <root>.SafeCollector' type=<root>.SafeCollector<T of <root>.onCompletion> origin=null
<class: T>: T of <root>.onCompletion
collector: GET_VAR '<this>: <root>.FlowCollector<T of <root>.onCompletion> declared in special.<anonymous>' type=<root>.FlowCollector<T of <root>.onCompletion> origin=null
collector: GET_VAR '<this>: <root>.FlowCollector<T of <root>.onCompletion> declared in <root>.onCompletion.<anonymous>' type=<root>.FlowCollector<T of <root>.onCompletion> origin=null
CALL 'public final fun invokeSafely <T> (action: kotlin.Function2<<root>.FlowCollector<T of <root>.invokeSafely>, kotlin.Throwable?, kotlin.Unit>): kotlin.Unit [suspend] declared in <root>' type=kotlin.Unit origin=null
<T>: T of <root>.onCompletion
$receiver: GET_VAR 'val safeCollector: <root>.SafeCollector<T of <root>.onCompletion> [val] declared in <root>.onCompletion.<anonymous>' type=<root>.SafeCollector<T of <root>.onCompletion> origin=null
@@ -81,7 +81,7 @@ FILE fqName:<root> fileName:/castsInsideCoroutineInference.kt
VAR name:channel type:<root>.ChannelCoroutine<kotlin.Any> [val]
TYPE_OP type=<root>.ChannelCoroutine<kotlin.Any> origin=CAST typeOperand=<root>.ChannelCoroutine<kotlin.Any>
CALL 'public abstract fun <get-channel> (): <root>.SendChannel<E of <root>.ProducerScope> declared in <root>.ProducerScope' type=<root>.SendChannel<kotlin.Any> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.ProducerScope<kotlin.Any> declared in special.<anonymous>' type=<root>.ProducerScope<kotlin.Any> origin=null
$this: GET_VAR '<this>: <root>.ProducerScope<kotlin.Any> declared in <root>.asFairChannel.<anonymous>' type=<root>.ProducerScope<kotlin.Any> origin=null
CALL 'public abstract fun collect (collector: <root>.FlowCollector<T of <root>.Flow>): kotlin.Unit [suspend] declared in <root>.Flow' type=kotlin.Unit origin=null
$this: GET_VAR 'flow: <root>.Flow<*> declared in <root>.asFairChannel' type=<root>.Flow<*> origin=null
collector: FUN_EXPR type=kotlin.Function1<kotlin.Any?, kotlin.Unit> origin=LAMBDA
@@ -125,7 +125,7 @@ FILE fqName:<root> fileName:/castsInsideCoroutineInference.kt
RETURN type=kotlin.Nothing from='local final fun <anonymous> (value: kotlin.Any?): kotlin.Unit declared in <root>.asChannel.<anonymous>'
CALL 'public abstract fun send (e: E of <root>.SendChannel): kotlin.Unit [suspend] declared in <root>.SendChannel' type=kotlin.Unit origin=null
$this: CALL 'public abstract fun <get-channel> (): <root>.SendChannel<E of <root>.ProducerScope> declared in <root>.ProducerScope' type=<root>.SendChannel<kotlin.Any> origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.ProducerScope<kotlin.Any> declared in special.<anonymous>' type=<root>.ProducerScope<kotlin.Any> origin=null
$this: GET_VAR '<this>: <root>.ProducerScope<kotlin.Any> declared in <root>.asChannel.<anonymous>' type=<root>.ProducerScope<kotlin.Any> origin=null
e: BLOCK type=kotlin.Any origin=ELVIS
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Any? [val]
GET_VAR 'value: kotlin.Any? declared in <root>.asChannel.<anonymous>.<anonymous>' type=kotlin.Any? origin=null