[
https://issues.apache.org/jira/browse/GROOVY-9498?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-9498.
-----------------------------
Assignee: Paul King
Resolution: Duplicate
It turns out we never back-ported GROOVY-8966 to the 2_5_X branch. I have done
that now.
> 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
> Assignee: Paul King
> Priority: Major
>
> 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)