Github user paplorinc commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/360#discussion_r69200220
  
    --- Diff: src/main/groovy/lang/IntRange.java ---
    @@ -377,40 +382,52 @@ public boolean containsAll(Collection other) {
     
         @Override
         public void step(int step, Closure closure) {
    -        if (step == 0) {
    -            if (!getFrom().equals(getTo())) {
    +        step((Number) step, closure);
    +    }
    +
    +    /**
    +     * {@inheritDoc}
    +     */
    +    @Override
    +    public void step(Number step, Closure closure) {
    +        final Long from = getFrom().longValue();
    +        final Long to = getTo().longValue();
    +
    +        if (compareEqual(step, 0)) {
    +            if (compareNotEqual(from, to)) {
                     throw new GroovyRuntimeException("Infinite loop detected 
due to step size of 0");
                 } else {
                     return; // from == to and step == 0, nothing to do, so 
return
                 }
             }
     
    -        if (isReverse()) {
    -            step = -step;
    +        boolean isAscending = !isReverse();
    +        if (compareLessThan(step, 0)) {
    +            step = multiply(step, -1);
    +            isAscending = !isAscending;
    --- End diff --
    
    I think github compares the commits in the wrong order, this is the final 
comparison:
    
https://github.com/apache/groovy/pull/360/files#diff-edcd680998449caffc50809917864ceeR454
    ```java
    if (compareLessThan(desiredStep, 0)) {
        step = multiply(desiredStep, -1);
        isAscending = range.isReverse();
    } else {
        step = desiredStep;
        isAscending = !range.isReverse();
    }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to