FIR: Fix test data after making LHS of assignment an expression

KT-54648
This commit is contained in:
Kirill Rakhman
2023-01-16 09:55:03 +01:00
committed by Space Team
parent ace47c06a5
commit 1eb18f13bd
68 changed files with 372 additions and 117 deletions
@@ -104,6 +104,21 @@ fun t5() {
}
}
fun t6() {
val i = 0
fun t5() {
<!VAL_REASSIGNMENT!>i<!> += 3
}
}
fun t7() {
for (i in 0..2) {
fun t5() {
<!VAL_REASSIGNMENT!>i<!> = 3
}
}
}
// ------------------------------------------------
// backing fields
@@ -104,6 +104,21 @@ fun t5() {
}
}
fun t6() {
val i = 0
fun t5() {
<!VAL_REASSIGNMENT!>i<!> += 3
}
}
fun t7() {
for (i in 0..2) {
fun t5() {
<!VAL_REASSIGNMENT!>i<!> = 3
}
}
}
// ------------------------------------------------
// backing fields
@@ -16,6 +16,8 @@ package uninitialized_reassigned_variables {
public fun t4(): kotlin.Unit
public fun t4(/*0*/ a: uninitialized_reassigned_variables.A): kotlin.Unit
public fun t5(): kotlin.Unit
public fun t6(): kotlin.Unit
public fun t7(): kotlin.Unit
public fun test(/*0*/ m: uninitialized_reassigned_variables.M): kotlin.Unit
public fun test1(/*0*/ m: uninitialized_reassigned_variables.M): kotlin.Unit
@@ -23,23 +23,23 @@ class P {
fun foo() {
val p = P()
<!INVISIBLE_SETTER!>p.x<!> = 34 //should be an error here
p.<!INVISIBLE_SETTER!>x<!> = 34 //should be an error here
p.y = 23
fun inner() {
<!INVISIBLE_SETTER!>p.x<!> = 44
p.<!INVISIBLE_SETTER!>x<!> = 44
}
}
class R {
val p = P();
init {
<!INVISIBLE_SETTER!>p.x<!> = 42
p.<!INVISIBLE_SETTER!>x<!> = 42
}
val testInGetterInOtherClass : Int
get() {
<!INVISIBLE_SETTER!>p.x<!> = 33
p.<!INVISIBLE_SETTER!>x<!> = 33
return 3
}
}
@@ -0,0 +1,36 @@
//KT-2960 Perform control flow checks for package property initializers
package b
class P {
var x : Int = 0
private set
}
val p = P()
var f = { -> p.<!INVISIBLE_SETTER!>x<!> = 32 }
val o = object {
fun run() {
p.<!INVISIBLE_SETTER!>x<!> = 4
val z : Int
doSmth(<!UNINITIALIZED_VARIABLE!>z<!>)
}
}
val g = { ->
val x: Int
doSmth(<!UNINITIALIZED_VARIABLE!>x<!>)
}
class A {
val a : Int = 1
get() {
val x : Int
doSmth(<!UNINITIALIZED_VARIABLE!>x<!>)
return field
}
}
fun doSmth(i: Int) = i
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
//KT-2960 Perform control flow checks for package property initializers
package b
@@ -34,4 +33,4 @@ class A {
}
}
fun doSmth(i: Int) = i
fun doSmth(i: Int) = i