Michael Winkler created GROOVY-9498:
---------------------------------------

             Summary: exclusive range operator gives wrong result when short 
variables is used
                 Key: GROOVY-9498
                 URL: https://issues.apache.org/jira/browse/GROOVY-9498
             Project: Groovy
          Issue Type: Bug
          Components: groovy-runtime
    Affects Versions: 2.5.10
            Reporter: Michael Winkler


this snippet worked in groovy 2.4 and did no longer in 2.5:
----
{color:#000043}*short* {color}maxAsShort = {color:#0000ff}5
 {color}*{color:#000043}int{color}* maxAsInt = {color:#0000ff}5
 {color}List<Byte> list = [{color:#0000ff}1{color}, {color:#0000ff}2{color}, 
{color:#0000ff}3{color}, {color:#0000ff}4{color}, {color:#0000ff}5{color}, 
{color:#0000ff}6{color}]
 
 *{color:#000043}assert{color}* list[{color:#0000ff}0{color}..<maxAsInt] == 
list[{color:#0000ff}0{color}..<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]}}
{{                          false}}{{at Script1.run(Script1.groovy:6)}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to