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

Parsing Error for Bitwise Operations in NewGroovy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-10
    • 1.0-beta-10
    • parser-antlr2
    • None
    • Windows, JDK 1.4.2_06

    Description

      // Problem 1 ------------------------------
      x = 7
      x = x << 2 // work
      println x

      x = 7
      x <<= 2 // Not work
      println x

      // Problem 2 ------------------------------
      x = 7
      x = x >> 2 // work
      println x

      x = 7
      x >>= 2 // not work
      println x

      // Problem 3 ------------------------------
      x = -7
      x = x >> 1 // work
      x = x >>> 1 // Not work
      x >>>= 1 // Not work

      // Problem 4 ------------------------------
      x = 7 & 1 // Not work
      x = 7 | 1 // Not work
      x = 7 ^ 1 // Not work
      x = 7 // Not work
      x &= 1 // Not work
      x |= 1 // Not work

      // Problem 5 ------------------------------
      x = ~3
      println x // Expected -4, but -3

      // Problem 6 ------------------------------
      x = 'A' & 1 // Error Stack Trace
      x = (char)'A' & 1 // Error Stack Trace
      x = 'A'.charAt(0) & 1 // Error Stack Trace

      Attachments

        Activity

          People

            phkim Kim, Pilho
            phkim Kim, Pilho
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: