Synthesize annotations for for/lists: if possible.
This commit is contained in:
parent
f4973ff05e
commit
2922821f3c
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user