Skip to content

Commit 9a579d2

Browse files
resyntax-ci[bot]samth
authored andcommitted
Fix 1 occurrence of and-let-to-cond
Using `cond` allows converting `let` to internal definitions, reducing nesting
1 parent 5713c93 commit 9a579d2

File tree

1 file changed

+13
-14
lines changed
  • typed-racket-test/unit-tests/shallow-rewrite-expansion

1 file changed

+13
-14
lines changed

typed-racket-test/unit-tests/shallow-rewrite-expansion/main.rkt

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -205,20 +205,19 @@
205205

206206
(list "case-lambda.rkt"
207207
(lambda (stx)
208-
(and
209-
(let* ((f0-stx (stx-find
210-
stx
211-
(syntax-predicate
212-
((~literal define-values) ((~datum f0)) ((~literal case-lambda) _)))))
213-
(f0-assert (stx-find-shape-check f0-stx))
214-
(f0-match? (shape-check-matches #:expr 'x #:shape 'symbol? #:type "Symbol")))
215-
(f0-match? f0-assert))
216-
(let* ((all-assert* (stx-find-shape-check* stx))
217-
(y-pred (shape-check-matches #:expr 'y #:shape 'none/c/proc #:type "Nothing"))
218-
(z-pred (shape-check-matches #:expr 'z #:shape 'none/c/proc #:type "Nothing")))
219-
(and
220-
(one-assert-matches y-pred all-assert*)
221-
(one-assert-matches z-pred all-assert*))))))
208+
(cond
209+
[(let* ([f0-stx (stx-find stx
210+
(syntax-predicate ((~literal define-values)
211+
((~datum f0))
212+
((~literal case-lambda) _))))]
213+
[f0-assert (stx-find-shape-check f0-stx)]
214+
[f0-match? (shape-check-matches #:expr 'x #:shape 'symbol? #:type "Symbol")])
215+
(f0-match? f0-assert))
216+
(define all-assert* (stx-find-shape-check* stx))
217+
(define y-pred (shape-check-matches #:expr 'y #:shape 'none/c/proc #:type "Nothing"))
218+
(define z-pred (shape-check-matches #:expr 'z #:shape 'none/c/proc #:type "Nothing"))
219+
(and (one-assert-matches y-pred all-assert*) (one-assert-matches z-pred all-assert*))]
220+
[else #f])))
222221

223222
(list "cdr.rkt"
224223
no-shape-check?)

0 commit comments

Comments
 (0)