Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5.0-alpha-1, 2.4.10
-
None
-
None
Description
def a def b = [1] a = b println "${a} : ${a.class}" // [1] : class java.util.ArrayList (a) = b println "${a} : ${a.class}" // 1 : class java.lang.Integer ((a)) = b println "${a} : ${a.class}" // [1] : class java.util.ArrayList
This is confusing. Here are options:
1. ((a)) = b should be failed to parse.
2. ((a)) = b should behave like (a) = b, i.e. number of parentheses should not matter.
3. ((a)) = b and (a) = b should behave like a = b. This will match the following case also:
class A { def myField } def a = new A() def b = [1] a.myField = b assert a.myField == [1] (a.myField) = b assert a.myField == [1] ((a.myField)) = b assert a.myField == [1]