Affects Version/s: None
Fix Version/s: 3.17
We should not raise S1488 when the assigned value depends on the variable itself.
An example of this is when shorthand assignment operators are used:
Why this happens?
In the implementation of rule S1488 we do consider expressions of type AssignmentExpressionTree. However, assignments with shorthand operators (i.e., .=, +=, -=, ...) are also represented as AssignmentExpressionTree. We should differentiate between those and only consider assignments with the normal assignment operator in the rule implementation. This also aligns with how the Java and JS analyzers behave in this rule.
However, this can also happen in cases like these:
Reported on community.