Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
2.5.0, 2.5.2, 2.5.4, 2.5.5
-
None
-
None
-
Ubuntu, Sun Java 8
Description
I was converting an if/else to a conditional and had the following error:
class org.codehaus.groovy.ast.expr.TernaryExpression, with its value '((codeTotals[$it[1]] == null)) ? 0 : codeTotals[$it[1]]', is a bad expression as the left hand side of an assignment operator at line: 50 column: 87.
My if/else (which works)is as follows:
if(codeTotals["${it[1]}"]==null){
codeTotals["${it[1]}"] = 0
}else{
codeTotals["${it[1]}"] += 1
}
... VS the logical conditional (which throws the error):
codeTotals["${it[1]}"] = (codeTotals["$it[1]"] == null) ? 0 : codeTotals["$it[1]"] +=1
Right now I am just trying to test some features but I thought this was weird enough to mention since a logical should work the same regardless of variable.