groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Wagenleitner (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (GROOVY-7218) && operator is not handled correctly in some cases when it starts a new line
Date Tue, 09 May 2017 22:09:04 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-7218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

John Wagenleitner resolved GROOVY-7218.
---------------------------------------
       Resolution: Fixed
         Assignee: John Wagenleitner
    Fix Version/s: 3.0.0-alpha-1

I tested the repro with the antlr4 parser and verified issue is fixed and that test coverage
exists:

https://github.com/apache/groovy/blob/734bff6f3336d5b2607f2749d1f986434711486b/subprojects/parser-antlr4/src/test/resources/core/Expression_23x.groovy#L94-L96

> && operator is not handled correctly in some cases when it starts a new line
> ----------------------------------------------------------------------------
>
>                 Key: GROOVY-7218
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7218
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.3.8
>         Environment: CentOS 7
>            Reporter: Maxim Novikov
>            Assignee: John Wagenleitner
>            Priority: Minor
>             Fix For: 3.0.0-alpha-1
>
>
> h3. Repro
> {code:title=A.groovy|borderStyle=solid}
> def files = new File(".").list(
>     [ accept: { d, f ->
>         (f ==~ ".*") && !f.endsWith(".tmp")
>     }] as FilenameFilter
> ).toList()
> {code}
> *Result:* works fine
> {code:title=B.groovy|borderStyle=solid}
> def files = new File(".").list(
>     [ accept: { d, f ->
>         (f ==~ ".*")
>             && !f.endsWith(".tmp")
>     }] as FilenameFilter
> ).toList()
> {code}
> *Result:*
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> /home/csbubbles/B.groovy: 5: unexpected token: && @ line 5, column 3.
>    		&& !f.endsWith(".tmp")
>      ^
> 1 error
> {code}
> h3. Expected results
> B.groovy should get executed successfully the same way as A.groovy, as its two lines
in a closure is the only expression.
> PS "return" statement doesn't help if you put it before "(f ==~ ".*")" either.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message