FIR: use dispatch receiver of the enclosing function if any.

This commit is contained in:
Jinseong Jeon
2020-03-24 15:58:40 -07:00
committed by Mikhail Glukhikh
parent a363a5be58
commit de0c9a5c73
47 changed files with 11 additions and 55 deletions
@@ -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
open class C(val f: () -> String)
class B(val x: String) {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
abstract class Base(val fn: () -> String)
open class Outer {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
abstract class Base(val fn: () -> String)
class Outer {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Point(val x:Int, val y:Int) {
fun mul() : (scalar:Int)->Point {
return { scalar:Int -> Point(x * scalar, y * scalar) }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: Foo.kt
package foo
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class X {
fun g(x: () -> Boolean = { super.equals(this) }) = x()
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
var sayResult = ""
class NoiseMaker {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
var result = ""
fun result(r: String) { result = r }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
//KT-3190 Compiler crash if function called 'invoke' calls a closure
// IGNORE_BACKEND: JS
@@ -1,5 +1,4 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND_FIR: JVM_IR
inline class Composed(val s: String) {
@@ -1,5 +1,4 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND_FIR: JVM_IR
inline class R(private val r: Int) {
fun test() = { ok() }()
@@ -1,5 +1,4 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND_FIR: JVM_IR
inline class R(private val r: Long) {
fun test() = { ok() }()
@@ -1,5 +1,4 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND_FIR: JVM_IR
inline class R(private val r: Int) {
fun test() = { ok() }()
@@ -1,5 +1,4 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND_FIR: JVM_IR
inline class R(private val r: Long) {
fun test() = { ok() }()
@@ -1,5 +1,4 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
inline class Z(private val i: Int) {
@@ -1,5 +1,4 @@
// !JVM_DEFAULT_MODE: enable
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// WITH_RUNTIME
@@ -1,5 +1,4 @@
// !JVM_DEFAULT_MODE: enable
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// 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
// TARGET_BACKEND: JVM
// WITH_RUNTIME
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// TARGET_BACKEND: JVM
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// TARGET_BACKEND: JVM
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun box(): String {
var log = ""
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,5 +1,4 @@
// !LANGUAGE: +ProperVisibilityForCompanionObjectInstanceField
// IGNORE_BACKEND_FIR: JVM_IR
inline fun on(body: () -> Any) = body().toString()
@@ -1,5 +1,4 @@
// !LANGUAGE: -ProperVisibilityForCompanionObjectInstanceField
// IGNORE_BACKEND_FIR: JVM_IR
inline fun on(body: () -> Any) = body().toString()
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
inline fun on(body: () -> Any) = body().toString()
class A {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// See KT-14999
object Obj {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class My {
val my: String = "O"
get() = { field }() + "K"
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class P {
var x : Int = 0
private set
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
open class A
class B : A() {
fun foo() = 1
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A {
public var prop = "OK"
private set
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A(
private val x: String,
private var y: Double
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Test {
private var i : Int
get() = 1
@@ -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
//KT-10934 compiler throws UninferredParameterTypeConstructor in when block that covers all types
class Parser<TInput, TValue>(val f: (TInput) -> Result<TInput, TValue>) {
-1
View File
@@ -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
open class C(val f: () -> Unit) {
fun test() {
f()
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
open class X(var s: ()-> Unit)
open class C(val f: X) {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: 1.kt
import b.B
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A {
fun foo() = o_plus_f_plus_k {""}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A {
private inline fun f() = g()
private fun g() = "OK"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Foo {
private val fld: String = "O"
get() = { field }() + "K"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Foo {
private val fld: String = "O"
get() = { field }() + "K"
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: kt36973.kt
import other.*