KT-30020 expressions without resolved calls in augmented assignment LHS

Augmented assignment operator (e.g., '+=') can be resolved to simple
function call ('plusAssign'). In that case, augmented assignment LHS
can be an arbitrary expression, and may have no associated ResolvedCall.

For example:
    (a as MutableList<Int>) += 42

Note that it can happen only in case of augmented assignment operator
convention resolution, because all other forms of assignment-like
operator desugaring require some kind of 'store' operation
(property setter, 'set' operator for array element expression, etc),
and should resolve to some combination of calls.

In that case we simply generate LHS on 'load', and throw assertion on
'store'.
This commit is contained in:
Dmitry Petrov
2019-02-22 13:02:24 +03:00
parent 1777849ff3
commit b792f3f12f
5 changed files with 367 additions and 4 deletions
@@ -987,6 +987,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
runTest("compiler/testData/ir/irText/expressions/kt28456b.kt");
}
@TestMetadata("kt30020.kt")
public void testKt30020() throws Exception {
runTest("compiler/testData/ir/irText/expressions/kt30020.kt");
}
@TestMetadata("lambdaInCAO.kt")
public void testLambdaInCAO() throws Exception {
runTest("compiler/testData/ir/irText/expressions/lambdaInCAO.kt");