diff --git a/collects/tests/typed-scheme/succeed/for.rkt b/collects/tests/typed-scheme/succeed/for.rkt index d7177415..5a67ae59 100644 --- a/collects/tests/typed-scheme/succeed/for.rkt +++ b/collects/tests/typed-scheme/succeed/for.rkt @@ -142,3 +142,21 @@ [j : Integer (in-range 1 10)]) (+ i j)) 185794560) + +;; multiclause versions of these don't currently work properly +(check = + (for*/sum: : Integer + ([i : Integer (in-range 10)]) + i) + 45) + +(check = + (for*/product: : Integer + ([i : Integer (in-range 10)]) + i) + 0) +(check = + (for*/product: : Integer + ([i : Integer (in-range 1 10)]) + i) + 362880) diff --git a/collects/typed-scheme/base-env/prims.rkt b/collects/typed-scheme/base-env/prims.rkt index 06b394d4..57ad6f50 100644 --- a/collects/typed-scheme/base-env/prims.rkt +++ b/collects/typed-scheme/base-env/prims.rkt @@ -759,7 +759,9 @@ This file defines two sorts of primitives. All of them are provided into any mod (for*/first: for*/first) (for*/last: for*/last) (for*/vector: for*/vector) - (for*/flvector: for*/flvector)) + (for*/flvector: for*/flvector) + (for*/sum: for*/sum) + (for*/product: for*/product)) ;; Like for/lists: and for/fold:, the inferencer can handle these correctly. (define-syntax (for*/lists: stx) diff --git a/collects/typed-scheme/scribblings/reference/special-forms.scrbl b/collects/typed-scheme/scribblings/reference/special-forms.scrbl index 3dacd9da..5e6dbec4 100644 --- a/collects/typed-scheme/scribblings/reference/special-forms.scrbl +++ b/collects/typed-scheme/scribblings/reference/special-forms.scrbl @@ -159,6 +159,8 @@ variants. @defform[(for*/or: type-ann-maybe (for:-clause ...) expr ...+)] @defform[(for*/first: type-ann-maybe (for:-clause ...) expr ...+)] @defform[(for*/last: type-ann-maybe (for:-clause ...) expr ...+)] +@defform[(for*/sum: type-ann-maybe (for:-clause ...) expr ...+)] +@defform[(for*/product: type-ann-maybe (for:-clause ...) expr ...+)] ]]{ These behave like their non-annotated counterparts, with the exception that @racket[#:when] clauses can only appear as the last