[FIR] Don't miss annotations while generating augmented assignments

^KT-62473 Fixed
This commit is contained in:
Nikolay Lunyak
2023-10-10 15:52:25 +03:00
committed by Space Team
parent 54e9cafc73
commit afc22728fa
3 changed files with 6 additions and 11 deletions
@@ -1326,6 +1326,7 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
name: Name,
source: KtSourceElement?,
referenceSource: KtSourceElement?,
annotations: List<FirAnnotation>,
receiver: FirExpression,
vararg arguments: FirExpression
): FirFunctionCall = buildFunctionCall {
@@ -1343,6 +1344,7 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
this.name = name
}
origin = FirFunctionCallOrigin.Operator
this.annotations.addAll(annotations)
}
}
@@ -1351,8 +1353,9 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
name,
baseElement.source?.fakeElement(KtFakeSourceElementKind.DesugaredCompoundAssignment),
referenceSource,
baseElement.annotations,
lhs,
rhs
rhs,
)
}
@@ -1590,6 +1593,7 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
OperatorNameConventions.SET,
augmentedArraySetCall.source,
augmentedArraySetCall.calleeReference.source,
annotations = augmentedArraySetCall.annotations,
receiver = arrayAccess, // a
*indicesQualifiedAccess.toTypedArray(), // indices
resolvedOperatorCall // a.get(b).plus(c)
@@ -1,10 +0,0 @@
// ISSUE: KT-62473
// WITH_STDLIB
class A(val list: List<*>)
fun test(a: A) {
val result = mutableListOf<Int>()
@Suppress("UNCHECKED_CAST")
result += (a.list <!UNCHECKED_CAST!>as List<Int><!>).filter { it > 0 }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// ISSUE: KT-62473
// WITH_STDLIB