K2: add more tests/fix augmented assignment case around KT-59748
This commit is contained in:
committed by
Space Team
parent
f20e2dec31
commit
5836a8aa0b
@@ -10,3 +10,20 @@ fun bar(list: MutableList<Any?>, condition: Boolean): Unit = <!RETURN_TYPE_MISMA
|
||||
condition -> list.set(0, "")
|
||||
else -> Unit
|
||||
}<!>
|
||||
|
||||
fun plusFoo(list: MutableList<String>, condition: Boolean): Unit = when {
|
||||
condition -> list[0] += ""
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
var x: String = ""
|
||||
|
||||
fun assign(condition: Boolean): Unit = when {
|
||||
condition -> x = ""
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
fun plugAssign(condition: Boolean): Unit = when {
|
||||
condition -> x += ""
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
@@ -25,3 +25,48 @@ FILE: listAssignmentInWhen.fir.kt
|
||||
}
|
||||
|
||||
}
|
||||
public final fun plusFoo(list: R|kotlin/collections/MutableList<kotlin/String>|, condition: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
^plusFoo when () {
|
||||
R|<local>/condition| -> {
|
||||
{
|
||||
{
|
||||
lval <array>: R|kotlin/collections/MutableList<kotlin/String>| = R|<local>/list|
|
||||
lval <index_0>: R|kotlin/Int| = Int(0)
|
||||
R|<local>/<array>|.R|SubstitutionOverride<kotlin/collections/MutableList.set: R|kotlin/String|>|(R|<local>/<index_0>|, R|<local>/<array>|.R|SubstitutionOverride<kotlin/collections/MutableList.get: R|kotlin/String|>|(R|<local>/<index_0>|).R|kotlin/String.plus|(String()))
|
||||
}
|
||||
|
||||
Unit
|
||||
}
|
||||
|
||||
}
|
||||
else -> {
|
||||
Q|kotlin/Unit|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final var x: R|kotlin/String| = String()
|
||||
public get(): R|kotlin/String|
|
||||
public set(value: R|kotlin/String|): R|kotlin/Unit|
|
||||
public final fun assign(condition: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
^assign when () {
|
||||
R|<local>/condition| -> {
|
||||
R|/x| = String()
|
||||
}
|
||||
else -> {
|
||||
Q|kotlin/Unit|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun plugAssign(condition: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
^plugAssign when () {
|
||||
R|<local>/condition| -> {
|
||||
R|/x| = R|/x|.R|kotlin/String.plus|(String())
|
||||
}
|
||||
else -> {
|
||||
Q|kotlin/Unit|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,3 +10,20 @@ fun bar(list: MutableList<Any?>, condition: Boolean): Unit = <!TYPE_MISMATCH!>wh
|
||||
condition -> list.set(0, "")
|
||||
else -> Unit
|
||||
}<!>
|
||||
|
||||
fun plusFoo(list: MutableList<String>, condition: Boolean): Unit = when {
|
||||
condition -> list[0] += ""
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
var x: String = ""
|
||||
|
||||
fun assign(condition: Boolean): Unit = when {
|
||||
condition -> x = ""
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
fun plugAssign(condition: Boolean): Unit = when {
|
||||
condition -> x += ""
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user