OC created GROOVY-11377:
---------------------------
Summary: wrong placement of error report in a closure
Key: GROOVY-11377
URL: https://issues.apache.org/jira/browse/GROOVY-11377
Project: Groovy
Issue Type: Bug
Components: Compiler
Affects Versions: 4.0.21, 3.0.3
Reporter: OC
Probably affects all Groovy 3 and 4 (possibly 5, haven't tried), but _not_
Groovy 2. Perhaps the Parrot parser? Groovy 3.0.3 is the oldest I've tested;
alas the Affects Versions does not allow entering something like “3+”, which
would make more sense I think.
Some errors in closures are reported as an unexpected input (which is all
right) _at the opening { of the closure_ (that's not OK). E.g.,
{code:java}
1035 ocs /tmp> /usr/local/groovy-4.0.21/bin/groovy q
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/private/tmp/q.groovy: 1: Unexpected input: '{' @ line 1, column 10.
10.times { bar()) }
^ {code}
Happens with longer multi-line closures as well, which might lead to a really
inconvenient search for the real culprit.
Note that normal non-closure blocks are not affected:
{code:java}
1036 ocs /tmp> /usr/local/groovy-4.0.21/bin/groovy w
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/private/tmp/w.groovy: 1: Unexpected input: '{ foo())' @ line 1, column 31.
for (int n=0;n<10;n++) { foo()) }
^ {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)