Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
This is IMO a regression (wrt. e.g. Groovy 2.4.11), the following does not compile in Groovy 3.0.10.
def fun = { arg -> return arg } fun ( x: 1, [a: 1]: '2' )
This is the combination of the following:
- map literal is used as an argument of a function, without enclosing brackets (I hope this is legal)
- another map literal is used as a key of the outer map (I hope this is legal too)
If both these preconditions are met, the compiler complains with:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
index.groovy: 5: Unexpected input: '(' @ line 5, column 5.
fun (
^
1 error
This does compile:
def fun = { arg -> return arg } fun ( x: 1, a: '2' )
So does this:
def fun = { arg -> return arg } fun ([ x: 1, [a: 1]: '2' ])
Is this a bug?