[ 
https://issues.apache.org/jira/browse/GROOVY-11377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18149214#comment-18149214
 ] 

Daniel Sun commented on GROOVY-11377:
-------------------------------------

Fixed on master; added a regression test in 
bce93970b3e1cb6cc322223e1ac5e35caa8b279d 
(https://github.com/apache/groovy/commit/bce93970b3e1cb6cc322223e1ac5e35caa8b279d).

> 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: parser-antlr4
>    Affects Versions: 3.0.3, 4.0.21
>            Reporter: OC
>            Assignee: Daniel Sun
>            Priority: Minor
>             Fix For: 7.0.0-alpha-1
>
>
> 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
(v10.3.26#10030026)

Reply via email to