Synthesize annotations for for/lists: if possible.
This commit is contained in:
parent
f4973ff05e
commit
2922821f3c
|
@ -4,3 +4,7 @@
|
||||||
(define (f x)
|
(define (f x)
|
||||||
(for/lists (#{y : (Listof Number)}) ([e (in-list x)])
|
(for/lists (#{y : (Listof Number)}) ([e (in-list x)])
|
||||||
e))
|
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.
|
;; clauses with these 2.
|
||||||
(define-syntax (for/lists: stx)
|
(define-syntax (for/lists: stx)
|
||||||
(syntax-parse stx #:literals (:)
|
(syntax-parse stx #:literals (:)
|
||||||
[(_ a:optional-standalone-annotation
|
[(_ : ty
|
||||||
((var:optionally-annotated-name) ...)
|
((var:optionally-annotated-name) ...)
|
||||||
(clause:for-clause ...)
|
(clause:for-clause ...)
|
||||||
c:expr ...)
|
c:expr ...)
|
||||||
(maybe-annotate-body
|
(syntax-property
|
||||||
(quasisyntax/loc stx
|
(quasisyntax/loc stx
|
||||||
(for/lists (var.ann-name ...)
|
(for/lists (var.ann-name ...)
|
||||||
(clause.expand ... ...)
|
(clause.expand ... ...)
|
||||||
c ...))
|
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)
|
(define-syntax (for/fold: stx)
|
||||||
(syntax-parse stx #:literals (:)
|
(syntax-parse stx #:literals (:)
|
||||||
[(_ : ty
|
[(_ : ty
|
||||||
|
|
Loading…
Reference in New Issue
Block a user