RawFirBuilder: fix label bounding for binary operations
#KT-57880 Fixed
This commit is contained in:
committed by
Space Team
parent
089222cecc
commit
147a3331a4
Vendored
+1
-1
@@ -114,7 +114,7 @@ digraph plusAssignWithLambdaInRhs_kt {
|
||||
44 [label="Postponed exit from lambda"];
|
||||
45 [label="Function call: R|/A.A|<R|T|>(...)" style="filled" fillcolor=yellow];
|
||||
46 [label="Jump: ^postpone R|/A.A|<R|T|>(<L> = A@fun <anonymous>(resolve: R|(T) -> kotlin/Unit|): R|kotlin/Unit| <inline=NoInline> {
|
||||
R|<local>/queue|.R|kotlin/collections/plusAssign|<R|() -> kotlin/Unit|>(A@fun <anonymous>(): R|kotlin/Unit| <inline=Inline> {
|
||||
R|<local>/queue|.R|kotlin/collections/plusAssign|<R|() -> kotlin/Unit|>(fun <anonymous>(): R|kotlin/Unit| <inline=Inline> {
|
||||
R|<local>/resolve|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(R|<local>/computation|.R|SubstitutionOverride<kotlin/Function0.invoke: R|T|>|())
|
||||
}
|
||||
)
|
||||
|
||||
Vendored
+1
-1
@@ -18,7 +18,7 @@ FILE: plusAssignWithLambdaInRhs.kt
|
||||
public final fun <T> postpone(computation: R|() -> T|): R|A<T>| {
|
||||
lval queue: R|kotlin/collections/MutableList<kotlin/Function0<kotlin/Unit>>| = R|kotlin/collections/mutableListOf|<R|() -> kotlin/Unit|>()
|
||||
^postpone R|/A.A|<R|T|>(<L> = A@fun <anonymous>(resolve: R|(T) -> kotlin/Unit|): R|kotlin/Unit| <inline=NoInline> {
|
||||
R|<local>/queue|.R|kotlin/collections/plusAssign|<R|() -> kotlin/Unit|>(A@fun <anonymous>(): R|kotlin/Unit| <inline=Inline> {
|
||||
R|<local>/queue|.R|kotlin/collections/plusAssign|<R|() -> kotlin/Unit|>(fun <anonymous>(): R|kotlin/Unit| <inline=Inline> {
|
||||
R|<local>/resolve|.R|SubstitutionOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(R|<local>/computation|.R|SubstitutionOverride<kotlin/Function0.invoke: R|T|>|())
|
||||
}
|
||||
)
|
||||
|
||||
+4
-4
@@ -267,6 +267,8 @@ class ExpressionsConverter(
|
||||
val operationToken = operationTokenName.getOperationSymbol()
|
||||
if (operationToken == IDENTIFIER) {
|
||||
context.calleeNamesForLambda += operationTokenName.nameAsSafeName()
|
||||
} else {
|
||||
context.calleeNamesForLambda += null
|
||||
}
|
||||
|
||||
val rightArgAsFir =
|
||||
@@ -277,10 +279,8 @@ class ExpressionsConverter(
|
||||
|
||||
val leftArgAsFir = getAsFirExpression<FirExpression>(leftArgNode, "No left operand")
|
||||
|
||||
if (operationToken == IDENTIFIER) {
|
||||
// No need for the callee name since arguments are already generated
|
||||
context.calleeNamesForLambda.removeLast()
|
||||
}
|
||||
// No need for the callee name since arguments are already generated
|
||||
context.calleeNamesForLambda.removeLast()
|
||||
|
||||
when (operationToken) {
|
||||
ELVIS ->
|
||||
|
||||
@@ -2380,15 +2380,15 @@ open class RawFirBuilder(
|
||||
|
||||
if (operationToken == IDENTIFIER) {
|
||||
context.calleeNamesForLambda += expression.operationReference.getReferencedNameAsName()
|
||||
} else {
|
||||
context.calleeNamesForLambda += null
|
||||
}
|
||||
|
||||
val leftArgument = expression.left.toFirExpression("No left operand")
|
||||
val rightArgument = expression.right.toFirExpression("No right operand")
|
||||
|
||||
if (operationToken == IDENTIFIER) {
|
||||
// No need for the callee name since arguments are already generated
|
||||
context.calleeNamesForLambda.removeLast()
|
||||
}
|
||||
// No need for the callee name since arguments are already generated
|
||||
context.calleeNamesForLambda.removeLast()
|
||||
|
||||
val source = expression.toFirSourceElement()
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class Context<T> {
|
||||
val currentClassId get() = ClassId(packageFqName, className, inLocalContext)
|
||||
|
||||
val firFunctionTargets = mutableListOf<FirFunctionTarget>()
|
||||
val calleeNamesForLambda = mutableListOf<Name>()
|
||||
val calleeNamesForLambda = mutableListOf<Name?>()
|
||||
|
||||
@PrivateForInline
|
||||
val _firLabels = mutableListOf<FirLabel>()
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
// ISSUE: KT-57880
|
||||
|
||||
fun outerLambda(action: String.() -> Unit) {}
|
||||
var lambda: Int.() -> Unit = {}
|
||||
fun consume(arg: String) {}
|
||||
|
||||
fun main() {
|
||||
outerLambda {
|
||||
lambda = {
|
||||
consume(<!ARGUMENT_TYPE_MISMATCH!>this@outerLambda<!>)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-57880
|
||||
|
||||
fun outerLambda(action: String.() -> Unit) {}
|
||||
var lambda: Int.() -> Unit = {}
|
||||
fun consume(arg: String) {}
|
||||
fun consumeInt(arg: Int) {}
|
||||
|
||||
fun main() {
|
||||
outerLambda {
|
||||
@@ -10,4 +12,10 @@ fun main() {
|
||||
consume(this@outerLambda)
|
||||
}
|
||||
}
|
||||
|
||||
outerLambda {
|
||||
lambda = innerLambda@{
|
||||
consumeInt(this@innerLambda)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user