diff --git a/collects/tests/typed-scheme/succeed/for-lists.rkt b/collects/tests/typed-scheme/succeed/for-lists.rkt index 2cd0205886..67ab75b7c9 100644 --- a/collects/tests/typed-scheme/succeed/for-lists.rkt +++ b/collects/tests/typed-scheme/succeed/for-lists.rkt @@ -4,3 +4,7 @@ (define (f x) (for/lists (#{y : (Listof Number)}) ([e (in-list x)]) e)) + +(for/lists: ([a : (Listof Number)]) + ([e (in-list '(1 2 3))]) + e) diff --git a/collects/typed-scheme/base-env/prims.rkt b/collects/typed-scheme/base-env/prims.rkt index 15e7017351..111bc7c940 100644 --- a/collects/typed-scheme/base-env/prims.rkt +++ b/collects/typed-scheme/base-env/prims.rkt @@ -540,16 +540,27 @@ This file defines two sorts of primitives. All of them are provided into any mod ;; clauses with these 2. (define-syntax (for/lists: stx) (syntax-parse stx #:literals (:) - [(_ a:optional-standalone-annotation + [(_ : ty ((var:optionally-annotated-name) ...) (clause:for-clause ...) c:expr ...) - (maybe-annotate-body + (syntax-property (quasisyntax/loc stx (for/lists (var.ann-name ...) (clause.expand ... ...) c ...)) - #'a.ty)])) + 'type-ascription + #'ty)] + [(_ ((var:annotated-name) ...) + (clause:for-clause ...) + c:expr ...) + (syntax-property + (quasisyntax/loc stx + (for/lists (var.ann-name ...) + (clause.expand ... ...) + c ...)) + 'type-ascription + #'(values var.ty ...))])) (define-syntax (for/fold: stx) (syntax-parse stx #:literals (:) [(_ : ty