Skip to content

Commit 41e4903

Browse files
Fix 4 occurrences of zero-comparison-to-positive?
This expression is equivalent to calling the `positive?` predicate.
1 parent 85971dc commit 41e4903

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

typed-racket-lib/typed-racket/typecheck/check-class-unit.rkt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@
213213
opt:opt-lambda^)
214214
;; it's only an interesting opt-lambda expansion if the number
215215
;; of optional arguments is greater than zero
216-
#:when (> (cadr (attribute opt.value)) 0)
216+
#:when (positive? (cadr (attribute opt.value)))
217217
#:do [(register/method #'meth-name)]
218218
#:with props-core
219219
(let* ([prop-val (attribute opt.value)]
@@ -1330,10 +1330,10 @@
13301330
(match-define (super-init-stxs provided-pos-args provided-inits)
13311331
super-new)
13321332
(define pos-init-diff (- (length provided-pos-args) (length super-inits)))
1333-
(cond [(and (> pos-init-diff 0) (not init-rest))
1333+
(cond [(and (positive? pos-init-diff) (not init-rest))
13341334
;; errror case that's caught above, do nothing
13351335
(void)]
1336-
[(> pos-init-diff 0)
1336+
[(positive? pos-init-diff)
13371337
(define-values (pos-args for-init-rest)
13381338
(split-at provided-pos-args (length super-inits)))
13391339
(for ([pos-arg pos-args]

typed-racket-lib/typed-racket/typecheck/tc-lambda-unit.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@
336336
[_ #f]))
337337

338338
(cond
339-
[(and (> (free-id-table-count aux-table) 0) (not rest-id))
339+
[(and (positive? (free-id-table-count aux-table)) (not rest-id))
340340
(tc/opt-lambda-clause arg-list body aux-table)]
341341
[else
342342
(define arg-types (get-types arg-list #:default (lambda () #f)))

0 commit comments

Comments
 (0)