Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3440

Closures behave differently on ++int and int++

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.6
    • None
    • syntax
    • None
    • Mac OS X

    Description

      Here is what I've got on 1.6:

      [1,2,3].collect

      {n -> ++n}

      returns as expected [2,3,4]

      and

      [1,2,3].collect

      {n -> n++}

      returns [1,2,3]

      I cannot believe this is not a bug.

      Attachments

        Activity

          People

            Unassigned Unassigned
            kyrill007 Kyrill Alyoshin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: