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

Nested closures : variable assignment ignored

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-5
    • 1.0-JSR-5
    • None
    • None

    Description

      The following code prints

      1
      1

      it should print

      1
      2

      class Test
      {
      static void main(args)
      {
      i = 1 // <--- remove this line and result is correct (1, 2)
      c = {
      i = 1
      println("i = ${i}")
      c1 =

      { i = 2 }

      c1()
      println("i = ${i}")
      }
      c()
      }
      }

      Attachments

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              pmbrant Peter Brant
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: