jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • groovy
  • GROOVY-277

print [1, 2].collect { it + 1 } doesn't seem to parse properly

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Won't Fix
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: ast builder, parser
  • Labels:
    None

Description

Bing Ran spotted this...

1> print [1,2].collect{it + 1}
2> execute
null

while this works:

1> list = [1,2]
2> print list.collect{it + 1}
3> execute
[2, 3]

Issue Links

is depended upon by

Task - A task that needs to be done. GROOVY-753 complete parser

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Chris Poirier added a comment - 15/Mar/04 2:02 PM

The new expression parser should fix this. RSN.

Show
Chris Poirier added a comment - 15/Mar/04 2:02 PM The new expression parser should fix this. RSN.
Hide
Permalink
Chris Poirier added a comment - 31/Mar/04 1:10 PM

At present, this can't be fixed. The parser is unable to tell [1, 2] the list from [1, 2] the array dereference. As a result, you will need to include parenthesis on the print() in order to make this work.

I'm leaving the issue open for now. Hopefully, we can fix it later.

Show
Chris Poirier added a comment - 31/Mar/04 1:10 PM At present, this can't be fixed. The parser is unable to tell [1, 2] the list from [1, 2] the array dereference. As a result, you will need to include parenthesis on the print() in order to make this work. I'm leaving the issue open for now. Hopefully, we can fix it later.
Hide
Permalink
Chris Poirier added a comment - 01/Apr/04 2:14 PM

I would like to think that we can get this to work at run time with a type test and a branch. In some cases, it might even be possible to choose at compile time, once the symbol table for the statement's scope has been calculated. Thoughts?

Show
Chris Poirier added a comment - 01/Apr/04 2:14 PM I would like to think that we can get this to work at run time with a type test and a branch. In some cases, it might even be possible to choose at compile time, once the symbol table for the statement's scope has been calculated. Thoughts?
Hide
Permalink
blackdrag blackdrag added a comment - 03/Feb/05 5:23 PM

this is not really a class generation bug

Show
blackdrag blackdrag added a comment - 03/Feb/05 5:23 PM this is not really a class generation bug
Hide
Permalink
Guillaume Laforge added a comment - 02/Nov/07 5:18 AM

Optional parenthesis are allowed for top-level statements, not for such complex ones.

Show
Guillaume Laforge added a comment - 02/Nov/07 5:18 AM Optional parenthesis are allowed for top-level statements, not for such complex ones.

People

  • Assignee:
    Guillaume Laforge
    Reporter:
    james strachan
Vote (0)
Watch (1)

Dates

  • Created:
    15/Mar/04 3:49 AM
    Updated:
    02/Nov/07 5:18 AM
    Resolved:
    02/Nov/07 5:18 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.