Skip to content

Commit ad0d0de

Browse files
AlexKnauthsamth
authored andcommitted
Improve typechecking for for/last and for*/last
1 parent abbdf18 commit ad0d0de

File tree

1 file changed

+4
-4
lines changed
  • typed-racket-lib/typed-racket/base-env

1 file changed

+4
-4
lines changed

typed-racket-lib/typed-racket/base-env/prims.rkt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,7 @@ the typed racket language.
390390
(for/list: for/list)
391391
(for/and: for/and)
392392
(for/or: for/or)
393-
(for/first: for/first)
394-
(for/last: for/last))
393+
(for/first: for/first))
395394

396395
;; Unlike with the above, the inferencer can handle any number of #:when
397396
;; clauses with these 2.
@@ -469,8 +468,7 @@ the typed racket language.
469468
(define-for*-variants
470469
(for*/and: for*/and)
471470
(for*/or: for*/or)
472-
(for*/first: for*/first)
473-
(for*/last: for*/last))
471+
(for*/first: for*/first))
474472

475473
;; Like for/lists: and for/fold:, the inferencer can handle these correctly.
476474
(define-syntax (for*/lists: stx)
@@ -548,6 +546,8 @@ the typed racket language.
548546
for*? #'for/folder: #'for/folder #'op #'initial #'final))
549547
...))]))
550548
(define-for/acc:-variants
549+
(for/last: for/fold: for/last #f begin #f #%expression)
550+
(for*/last: for*/fold: for*/last #t begin #f #%expression)
551551
(for/sum: for/fold: for/sum #f + 0 #%expression)
552552
(for*/sum: for*/fold: for*/sum #t + 0 #%expression)
553553
(for*/list: for*/fold: for*/list #t (lambda (x y) (cons y x)) null reverse)

0 commit comments

Comments
 (0)