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
@@ -6,6 +6,6 @@ FILE: fieldPlusAssign.kt
}
public final val y: R|kotlin/Int| = Int(1)
public get(): R|kotlin/Int| {
<Re-assigning a val variable># = F|/y|.R|kotlin/Int.plus|(Int(1))
F|/y| = F|/y|.R|kotlin/Int.plus|(Int(1))
^ Int(1)
}
@@ -14,7 +14,7 @@ class Some {
<!VAL_REASSIGNMENT!>z<!> = "error"
fun foo() {
<!CAPTURED_MEMBER_VAL_INITIALIZATION!>x<!> = "error" // VAL_REASSIGNMENT also ok (or even better?)
<!VAL_REASSIGNMENT!>x<!> = "error"
<!CAPTURED_MEMBER_VAL_INITIALIZATION!>y<!> = "error"
<!VAL_REASSIGNMENT!>z<!> = "error"
}
@@ -73,5 +73,5 @@ class B5 : A5() {
}
fun test5() {
<!INVISIBLE_SETTER!>B5().attribute<!> = "c"
B5().<!INVISIBLE_SETTER!>attribute<!> = "c"
}
+2 -2
View File
@@ -2,7 +2,7 @@ fun <T> bar(): T {
return null <!UNCHECKED_CAST!>as T<!>
}
class X() : <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>B<!> by <!ASSIGNMENT_IN_EXPRESSION_CONTEXT!><!VARIABLE_EXPECTED!>get()<!> = bar()<!> {
val prop = <!ASSIGNMENT_IN_EXPRESSION_CONTEXT!><!VARIABLE_EXPECTED!>bar()<!> = 2<!>
class X() : <!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>B<!> by <!ASSIGNMENT_IN_EXPRESSION_CONTEXT!><!VARIABLE_EXPECTED!><!UNRESOLVED_REFERENCE!>get<!>()<!> = bar()<!> {
val prop = <!ASSIGNMENT_IN_EXPRESSION_CONTEXT!><!VARIABLE_EXPECTED!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!>()<!> = 2<!>
}
@@ -0,0 +1,24 @@
FILE: assignmentWithWrongLhs.kt
public final fun foo(): R|kotlin/Int| {
^foo Int(1)
}
public final fun test(): R|kotlin/Unit| {
R|/foo|() = Int(1)
R|/foo|().R|kotlin/Int.toString|() = Int(1)
when () {
Boolean(true) -> {
R|/foo|()
}
else -> {
Int(1)
}
}
= String()
R|kotlin/run|<R|kotlin/Unit|>(<L> = run@fun <anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
R|kotlin/io/print|(String(To string)).R|kotlin/also|<R|kotlin/Unit|>(<L> = also@fun <anonymous>(it: R|kotlin/Unit|): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
R|kotlin/io/print|(R|<local>/it|)
}
)
}
) = Int(1)
}
@@ -0,0 +1,10 @@
fun foo(): Int = 1
fun test() {
<!VARIABLE_EXPECTED!>foo()<!> = 1
foo().<!VARIABLE_EXPECTED!>toString()<!> = <!ASSIGNMENT_TYPE_MISMATCH!>1<!>
(<!VARIABLE_EXPECTED!>if (true) foo() else 1<!>) = <!ASSIGNMENT_TYPE_MISMATCH!>""<!>
<!VARIABLE_EXPECTED!>run {
print("To string").also { print(it) }
}<!> = <!ASSIGNMENT_TYPE_MISMATCH!>1<!>
}
@@ -18,5 +18,5 @@ FILE: hashSet.kt
public final fun foo(): R|kotlin/Unit| {
lvar c: R|kotlin/collections/MutableSet<kotlin/String>?| = Null(null)
R|<local>/c| = R|java/util/HashSet.HashSet|<R|kotlin/String|>()
R|<local>/c|!!.R|/d| = R|/produce|<R|kotlin/String?|>()
R|<local>/c|!!.R|/d|<R|kotlin/String|> = R|/produce|<R|kotlin/String?|>()
}
@@ -1,10 +1,10 @@
FILE: listPlusAssign.kt
public final fun R|kotlin/collections/List<kotlin/String>|.modify(): R|kotlin/Unit| {
<Variable expected># = this@R|/modify|.R|kotlin/collections/plus|<R|kotlin/String|>(String(Alpha))
<Variable expected># = this@R|/modify|.R|kotlin/collections/plus|<R|kotlin/String|>(String(Omega))
this@R|/modify| = this@R|/modify|.R|kotlin/collections/plus|<R|kotlin/String|>(String(Alpha))
this@R|/modify| = this@R|/modify|.R|kotlin/collections/plus|<R|kotlin/String|>(String(Omega))
}
public final fun R|kotlin/Any|.modify(): R|kotlin/Unit| {
<Variable expected># = (this@R|/modify| as R|kotlin/collections/List<kotlin/Int>|).R|kotlin/collections/plus|<R|kotlin/Int|>(Int(42))
(this@R|/modify| as R|kotlin/collections/List<kotlin/Int>|) = (this@R|/modify| as R|kotlin/collections/List<kotlin/Int>|).R|kotlin/collections/plus|<R|kotlin/Int|>(Int(42))
}
public final operator fun <T> R|kotlin/collections/Set<T>|.plusAssign(x: R|T|): R|kotlin/Unit| {
}
@@ -1,8 +1,8 @@
// COMPARE_WITH_LIGHT_TREE
fun List<String>.modify() {
<!VARIABLE_EXPECTED{PSI}!>this<!> += "Alpha"
<!VARIABLE_EXPECTED{PSI}!>this<!> += "Omega"
<!VARIABLE_EXPECTED!>this<!> += "Alpha"
<!VARIABLE_EXPECTED!>this<!> += "Omega"
}
fun Any.modify() {