groovy
  1. groovy
  2. GROOVY-2850

VerifyError when using increment operator on value

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.6-beta-2
    • Fix Version/s: 1.6-rc-1, 1.5.8, 1.7-beta-1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Mac OS 10.5.2
      Java 1.5.0_13
      Groovy 1.6-beta-2-SNAPSHOT
    • Number of attachments :
      0

      Description

      It seems that in Groovy, the increment/decrement operator is not only allowed
      on variables, but also on values. Here is a script that compiles without
      problems:

      def x = 0
      println(id(x)++)
      
      def id(x) { x }
      

      However, at runtime I get:
      Caught: java.lang.VerifyError: (class: IncTest, method: run signature:
      ()Ljava/lang/Object Incompatible object argument for function call

        Activity

        Hide
        Peter Niederwieser added a comment -

        Once again the code, this time hopefully with proper formatting:

        def x = 0
        println(id(x)++)
        
        def id(x) { x }
        
        Show
        Peter Niederwieser added a comment - Once again the code, this time hopefully with proper formatting: def x = 0 println(id(x)++) def id(x) { x }
        Hide
        Paul King added a comment -

        add code tags

        Show
        Paul King added a comment - add code tags

          People

          • Assignee:
            blackdrag blackdrag
            Reporter:
            Peter Niederwieser
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: