Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.6-beta-1, 1.6-beta-2
-
None
-
None
-
Ubuntu amd64. Java 1.6.0_07-b06.
Description
Running the code
short upper = 4
println (0..<upper)
results in [0] in Groovy 1.6. With Groovy 1.5.6, this resulted in [0, 1, 2, 3].
It doesn't seem to matter what values are used on the left and right hand side of the ranges. As long as the left hand value is an int and the right hand value is a short, the range always contains a single element containing the value of the int.
This only affects half-exclusive ranges. The following code correctly returns [0, 1, 2, 3, 4] with Groovy 1.6.
short upper = 4
println (0..upper)