Skip to content

Commit d372973

Browse files
Fix 2 occurrences of if-else-false-to-and
This `if` expression can be refactored to an equivalent expression using `and`.
1 parent 69f11b7 commit d372973

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

typed-racket-lib/typed-racket/rep/object-rep.rkt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,7 @@
313313
(-> OptObject? (or/c #f exact-integer?))
314314
(match l
315315
[(LExp: c terms)
316-
(if (hash-empty? terms)
317-
c
318-
#f)]
316+
(and (hash-empty? terms) c)]
319317
[_ #f]))
320318

321319
(define/cond-contract (in-LExp? obj l)

typed-racket-lib/typed-racket/static-contracts/combinators/function.rkt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,10 @@
146146
(match-define (function-combinator args indices mand-kws opt-kws typed-side?) v)
147147
(define-values (mand-args opt-args mand-kw-args opt-kw-args rest-arg range-args)
148148
(apply split-function-args args indices))
149-
(if (and (not rest-arg)
150-
(null? (append mand-kw-args mand-args opt-kw-args opt-args))
151-
typed-side?)
152-
;; currently we only handle this trivial case
153-
;; we could probably look at the actual kind of `range-args` as well
154-
(if (not range-args) 'flat #f)
155-
#f))
149+
(and (and (not rest-arg) (null? (append mand-kw-args mand-args opt-kw-args opt-args)) typed-side?)
150+
;; currently we only handle this trivial case
151+
;; we could probably look at the actual kind of `range-args` as well
152+
(if (not range-args) 'flat #f)))
156153

157154

158155
(define (function-sc-constraints v f)

0 commit comments

Comments
 (0)