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

Inconsistent stack height with "if" in closure

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.0-beta-4
    • 1.0-beta-5
    • None
    • None
    • Mac OS X, both RC4 and CVS HEAD

    Description

      The script

      token = null
      closure = {
      if (token == null) token = "hi"
      return token
      }
      println closure.call()

      fails with an Inconsistent stack height 1 != 0 error. It fails no matter what the format of the "if" statement. It also fails if the closure is a function instead, like this:

      def foo(str) {
      token = null
      str.each

      { if (token == null) token = "hi" }

      return token
      }
      println foo()

      Attachments

        Activity

          People

            jstrachan James Strachan
            jimm Jim Menard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: