[
https://issues.apache.org/jira/browse/GROOVY-8941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18149154#comment-18149154
]
Daniel Sun commented on GROOVY-8941:
------------------------------------
Fixed on master; added a regression test in
195c7cb5603a46212647ecec290ea39f6157238a
(https://github.com/apache/groovy/commit/195c7cb5603a46212647ecec290ea39f6157238a).
> unexpected parsing of command chain with nested command chain
> -------------------------------------------------------------
>
> Key: GROOVY-8941
> URL: https://issues.apache.org/jira/browse/GROOVY-8941
> Project: Groovy
> Issue Type: Bug
> Components: groovy-console
> Affects Versions: 2.5.2
> Environment: jdk: oracle jdk 1.8.0_191
> groovy: 2.5.2
> os: windows
> Reporter: ShaoXian Song
> Assignee: Daniel Sun
> Priority: Major
> Labels: dsl
> Fix For: 7.0.0-alpha-1
>
>
> I'm using groovyConsole to see the generated class code of the following two
> Groovy scripts:
> {code:java}
> process test{
> output:
> file 'output.txt' into b, c
> """
> echo hello
> """
> }
> {code}
> Here is its generated code snippet like below:
> {code:java}
> public java.lang.Object run() {
> this.process(this.test({
> this.file('output.txt').into(b, c)
> '\n echo hello\n '
> }))
> }
> {code}
> And here is the second script that differs from the previous one - this one
> uses parentheses in file() method invocation:
> {code:java}
> process test{
> output:
> file('output.txt') into b, c
> """
> echo hello
> """
> }
> {code}
> And this is generated code from the second script:
> {code:java}
> public java.lang.Object run() {
> process.test({
> this.file('output.txt').into(b, c)
> '\n echo hello\n '
> })
> }
> {code}
> As you can see, {{process}} is no longer a function but a variable. It
> confuses me because I would expect that in both cases {{process}} should be
> seen as a function call. Is this an expected behavior? Do I miss something?
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)