K2: generate Unit conversion for indexed assignment at raw FIR stage
#KT-59748 Fixed
This commit is contained in:
committed by
Space Team
parent
1832413a02
commit
f20e2dec31
Vendored
+2
@@ -29,6 +29,7 @@ FILE: unsafeAssignmentExtra.fir.kt
|
||||
public final fun main(arg: R|kotlin/Any|, condition: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
lval value: R|Foo<kotlin/Int>| = R|/myBuilder|<R|kotlin/Int|>(<L> = myBuilder@fun R|Foo<kotlin/Int>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.b: R|kotlin/Array<Stub (chain inference): TypeVariable(T)>|>|.R|SubstitutionOverride<kotlin/Array.set: R|kotlin/Unit|>|(Int(0), Int(123))
|
||||
Unit
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(45)
|
||||
{
|
||||
lval <unary>: R|kotlin/Int| = this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|
|
||||
@@ -103,6 +104,7 @@ FILE: unsafeAssignmentExtra.fir.kt
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.accept: R|kotlin/Unit|>|(String())
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(45)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.b: R|kotlin/Array<Stub (chain inference): TypeVariable(T)>|>|.R|SubstitutionOverride<kotlin/Array.set: R|kotlin/Unit|>|(Int(0), Int(123))
|
||||
Unit
|
||||
R|<local>/baz|(this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// ISSUE: KT-59748
|
||||
// FIR_DUMP
|
||||
|
||||
fun foo(list: MutableList<Any?>, condition: Boolean): Unit = <!RETURN_TYPE_MISMATCH!>when {
|
||||
fun foo(list: MutableList<Any?>, condition: Boolean): Unit = when {
|
||||
condition -> list[0] = ""
|
||||
else -> Unit
|
||||
}<!>
|
||||
}
|
||||
|
||||
fun bar(list: MutableList<Any?>, condition: Boolean): Unit = <!RETURN_TYPE_MISMATCH!>when {
|
||||
condition -> list.set(0, "")
|
||||
|
||||
@@ -2,7 +2,11 @@ FILE: listAssignmentInWhen.fir.kt
|
||||
public final fun foo(list: R|kotlin/collections/MutableList<kotlin/Any?>|, condition: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
^foo when () {
|
||||
R|<local>/condition| -> {
|
||||
R|<local>/list|.R|SubstitutionOverride<kotlin/collections/MutableList.set: R|kotlin/Any?|>|(Int(0), String())
|
||||
{
|
||||
R|<local>/list|.R|SubstitutionOverride<kotlin/collections/MutableList.set: R|kotlin/Any?|>|(Int(0), String())
|
||||
Unit
|
||||
}
|
||||
|
||||
}
|
||||
else -> {
|
||||
Q|kotlin/Unit|
|
||||
|
||||
Reference in New Issue
Block a user