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

exclusive range operator gives wrong result when short variables is used

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.5.10
    • Fix Version/s: None
    • Component/s: groovy-runtime
    • Labels:
      None

      Description

      this snippet worked in groovy 2.4 and did no longer in 2.5:


      short maxAsShort = 5
      int maxAsInt = 5
      List<Byte> list = [1, 2, 3, 4, 5, 6]

      assert list[0..<maxAsInt] == list[0..<maxAsShort ]


      error message is:

      Assertion failed:

      assert list[0..<maxAsInt] == list[0..<maxAsShort]
             |   |    |         |  |   |    |
             |   |    5         |  |   |    5
             |   [1, 2, 3, 4, 5]|  |   [1, 2, 3, 4, 5, 6]
             [1, 2, 3, 4, 5, 6][1, 2, 3, 4, 5, 6]
                                falseat Script1.run(Script1.groovy:6)

        Attachments

          Activity

            People

            • Assignee:
              paulk Paul King
              Reporter:
              Michael W. Michael Winkler
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: