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

@CompileStatic does not support empty ranges properly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.9, 2.2.1
    • Fix Version/s: 2.2.2
    • Component/s: Static compilation
    • Labels:
      None

      Description

      In the following script, the empty range is apparently treated as a slice of size 1:

      testMethod()
      
      @groovy.transform.CompileStatic
      def testMethod() {
          def list = ["1", "2", "3", "4"]
      
          assert list[0..<0] == []
          println list
      }
      

      If you remove the annotation, the assertion passes.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                melix C├ędric Champeau
                Reporter:
                pledbrook Peter Ledbrook
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: