[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, name: Name,
source: KtSourceElement?, source: KtSourceElement?,
referenceSource: KtSourceElement?, referenceSource: KtSourceElement?,
annotations: List<FirAnnotation>,
receiver: FirExpression, receiver: FirExpression,
vararg arguments: FirExpression vararg arguments: FirExpression
): FirFunctionCall = buildFunctionCall { ): FirFunctionCall = buildFunctionCall {
@@ -1343,6 +1344,7 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
this.name = name this.name = name
} }
origin = FirFunctionCallOrigin.Operator origin = FirFunctionCallOrigin.Operator
this.annotations.addAll(annotations)
} }
} }
@@ -1351,8 +1353,9 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
name, name,
baseElement.source?.fakeElement(KtFakeSourceElementKind.DesugaredCompoundAssignment), baseElement.source?.fakeElement(KtFakeSourceElementKind.DesugaredCompoundAssignment),
referenceSource, referenceSource,
baseElement.annotations,
lhs, lhs,
rhs rhs,
) )
} }
@@ -1590,6 +1593,7 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
OperatorNameConventions.SET, OperatorNameConventions.SET,
augmentedArraySetCall.source, augmentedArraySetCall.source,
augmentedArraySetCall.calleeReference.source, augmentedArraySetCall.calleeReference.source,
annotations = augmentedArraySetCall.annotations,
receiver = arrayAccess, // a receiver = arrayAccess, // a
*indicesQualifiedAccess.toTypedArray(), // indices *indicesQualifiedAccess.toTypedArray(), // indices
resolvedOperatorCall // a.get(b).plus(c) 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 // ISSUE: KT-62473
// WITH_STDLIB // WITH_STDLIB