Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix off-by-one error in infinite range subscript
Subscripting with an infinite range was inconsistent between `0 ..^ Inf` and `0 ..^ *`. This commit makes both behave like the former: (^3)[0 .. Inf] eqv (0,1,2) (^3)[0 ..^ Inf] eqv (0,1,2) # Inf-1 is Inf (^3)[0 .. *] eqv (0,1,2) (^3)[0 ..^ *] eqv (0,1,2) # used to be (0,1) The difference came from an nqp::eqaddr(pos.max, Inf) condition which the `0 .. Inf` range did *not* pass but the `0 .. *` one did. Result of that condition was treating the range as if it had upper endpoint `.elems - 1` which seems off-by-one. Notice that there is no behavior specified for this in roast. Setting it to `.elems` instead makes it at least consistent with WhateverCode passed to the subscript: (^3)[0 ..^ *].tail == (^3)[*-1] # True with this commit Closes #2872
- Loading branch information