[FIR] Generate dispatch & extension receivers for variable assignments

This commit is contained in:
Mikhail Glukhikh
2020-04-03 15:14:01 +03:00
parent 774fc32f3e
commit d7460d47de
33 changed files with 9 additions and 28 deletions
@@ -1,4 +1,4 @@
FILE: main.kt
public final fun test(b: R|B|): R|kotlin/Unit| {
R|/B.text| = R|<local>/b|.R|/B.text|.R|kotlin/String.plus|(String())
R|<local>/b|.R|/B.text| = R|<local>/b|.R|/B.text|.R|kotlin/String.plus|(String())
}
@@ -290,6 +290,10 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) :
source = operatorCall.argument.source
diagnostic = ConeVariableExpectedError()
}
(leftArgument as? FirQualifiedAccess)?.let {
dispatchReceiver = it.dispatchReceiver
extensionReceiver = it.extensionReceiver
}
}
assignment.transform(transformer, ResolutionMode.ContextIndependent)
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A(var value: String)
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A(var value: String)
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A(var value: String)
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(var x: Int, var y: String)
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
object Test {
var z = "0"
var l = 0L
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
var z = "0"
var l = 0L
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class MyString {
var s = ""
operator fun plus(x : String) : MyString {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class MyString {
var s = ""
operator fun plus(x : String) : MyString {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
//KT-3869 Loops and finally: outer finally block not run
class MyString {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
//test for appropriate
class MyString {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
open class T(var value: Int) {}
fun plusAssign(): T {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
open class T(var value: Int) {}
fun localExtensionOnNullableParameter(): T {
@@ -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,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package foo
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
var log = ""
class A(p: String) {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
var log = ""
class A(p: String) {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A() {
var x = 0
}
@@ -1,5 +1,4 @@
// !LANGUAGE: -ProhibitOperatorMod
// IGNORE_BACKEND_FIR: JVM_IR
class A() {
var x = 5
@@ -1,5 +1,4 @@
// !LANGUAGE: -ProhibitOperatorMod
// IGNORE_BACKEND_FIR: JVM_IR
class A() {
var x = 5
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Slot() {
var vitality: Int = 10000
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// Enable when KT-14833 is fixed.
// IGNORE_BACKEND: JVM
import kotlin.reflect.KProperty
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
var sideEffects: String = ""
class A {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
internal var sideEffects: String = ""
internal class A {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
var sideEffects: String = ""
class A() {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
var sideEffects: String = ""
abstract class B protected constructor(val arg: Int) {
@@ -219,6 +219,7 @@ FILE fqName:<root> fileName:/complexAugmentedAssignment.kt
VALUE_PARAMETER name:b index:0 type:<root>.B
BLOCK_BODY
CALL 'public final fun <set-s> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.B' type=kotlin.Unit origin=EQ
$this: GET_VAR '<this>: <root>.B declared in <root>.Host.plusAssign' type=<root>.B origin=null
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
$this: CALL 'public final fun <get-s> (): kotlin.Int declared in <root>.B' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.B declared in <root>.Host.plusAssign' type=<root>.B origin=null
@@ -17,6 +17,7 @@ FILE fqName:<root> fileName:/javaSyntheticGenericPropertyAccess.kt
$this: GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.test' type=kotlin.Int origin=null
CALL 'public open fun <set-foo> (x: kotlin.Int): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=EQ
$this: GET_VAR 'j: <root>.J<F of <root>.test> declared in <root>.test' type=<root>.J<F of <root>.test> origin=null
x: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
$this: CALL 'public open fun <get-foo> (): kotlin.Int declared in <root>.J' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'j: <root>.J<F of <root>.test> declared in <root>.test' type=<root>.J<F of <root>.test> origin=null
@@ -16,6 +16,7 @@ FILE fqName:<root> fileName:/javaSyntheticPropertyAccess.kt
$this: GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.test' type=kotlin.Int origin=null
GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.test' type=kotlin.Int origin=null
CALL 'public open fun <set-foo> (x: kotlin.Int): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=EQ
$this: GET_VAR 'j: <root>.J declared in <root>.test' type=<root>.J origin=null
x: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
$this: CALL 'public open fun <get-foo> (): kotlin.Int declared in <root>.J' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR 'j: <root>.J declared in <root>.test' type=<root>.J origin=null
@@ -82,6 +82,7 @@ FILE fqName:<root> fileName:/kt16904.kt
$this: GET_VAR '<this>: <root>.Test1 declared in <root>.Test1' type=<root>.Test1 origin=null
x: CONST Int type=kotlin.Int value=42
CALL 'public final fun <set-y> (<set-?>: kotlin.Int): kotlin.Unit declared in <root>.A' type=kotlin.Unit origin=EQ
$this: GET_VAR '<this>: <root>.Test1 declared in <root>.Test1' type=<root>.Test1 origin=null
<set-?>: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
$this: CALL 'public final fun <get-y> (): kotlin.Int declared in <root>.A' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.Test1 declared in <root>.Test1' type=<root>.Test1 origin=null