Skip to content

Commit ad95915

Browse files
committed
Fix a bug in comparison shortcuts
See [this comment](racket/drracket@5c7c19f#r2040841364).
1 parent 7efe787 commit ad95915

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

default-recommendations/comparison-shortcuts-test.rkt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@ header:
1414

1515
test: "comparison of difference to zero refactorable to direct > comparison"
1616
- (> (- x y) 0)
17-
- (<= 0 (- x y))
17+
- (< 0 (- x y))
1818
- (> x y)
1919

2020

2121
test: "comparison of difference to zero refactorable to direct < comparison"
2222
- (< (- x y) 0)
23-
- (>= 0 (- x y))
23+
- (> 0 (- x y))
2424
- (< x y)
2525

2626

2727
test: "comparison of difference to zero refactorable to direct >= comparison"
28-
- (< 0 (- x y))
28+
- (<= 0 (- x y))
2929
- (>= (- x y) 0)
3030
- (>= x y)
3131

3232

3333
test: "comparison of difference to zero refactorable to direct <= comparison"
34-
- (> 0 (- x y))
34+
- (>= 0 (- x y))
3535
- (<= (- x y) 0)
3636
- (<= x y)
3737

default-recommendations/comparison-shortcuts.rkt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
(pattern (< (- x y) 0) #:with direct-comparison #'(< x y))
2626
(pattern (>= (- x y) 0) #:with direct-comparison #'(>= x y))
2727
(pattern (<= (- x y) 0) #:with direct-comparison #'(<= x y))
28-
(pattern (> 0 (- x y)) #:with direct-comparison #'(<= x y))
29-
(pattern (< 0 (- x y)) #:with direct-comparison #'(>= x y))
30-
(pattern (>= 0 (- x y)) #:with direct-comparison #'(< x y))
31-
(pattern (<= 0 (- x y)) #:with direct-comparison #'(> x y)))
28+
(pattern (> 0 (- x y)) #:with direct-comparison #'(< x y))
29+
(pattern (< 0 (- x y)) #:with direct-comparison #'(> x y))
30+
(pattern (>= 0 (- x y)) #:with direct-comparison #'(<= x y))
31+
(pattern (<= 0 (- x y)) #:with direct-comparison #'(>= x y)))
3232

3333

3434
(define-refactoring-rule comparison-of-difference-and-zero-to-direct-comparison

0 commit comments

Comments
 (0)