Kept track of source location better in the for: macros and got rid of
useless type ascriptions. original commit: 22a652ef8effe8cf670cd69221cb3dd4689b6a21
This commit is contained in:
parent
431d91bf89
commit
848b6f0e02
|
@ -9,18 +9,22 @@
|
|||
|
||||
(define-splicing-syntax-class for-clause
|
||||
;; single-valued seq-expr
|
||||
(pattern (var:annotated-name seq-expr:expr)
|
||||
#:with (expand ...) (list #`(var.ann-name
|
||||
(pattern (~and c (var:annotated-name seq-expr:expr))
|
||||
#:with (expand ...) (list (quasisyntax/loc
|
||||
#'c
|
||||
(var.ann-name
|
||||
#,(syntax-property #'seq-expr
|
||||
'type-ascription
|
||||
#'(Sequenceof var.ty)))))
|
||||
#'(Sequenceof var.ty))))))
|
||||
;; multi-valued seq-expr
|
||||
;; currently disabled because it triggers an internal error in the typechecker
|
||||
#;(pattern (((v:annotated-name) ...) seq-expr:expr)
|
||||
#:with (expand ...) (list #`((v.ann-name ...)
|
||||
#;(pattern (~and c (((v:annotated-name) ...) seq-expr:expr))
|
||||
#:with (expand ...) (list (quasisyntax/loc
|
||||
#'c
|
||||
((v.ann-name ...)
|
||||
#,(syntax-property #'seq-expr
|
||||
'type-ascription
|
||||
#'(Sequenceof (values v.ty ...))))))
|
||||
#'(Sequenceof (values v.ty ...)))))))
|
||||
;; when clause
|
||||
(pattern (~seq #:when guard:expr)
|
||||
#:with (expand ...) (list #'#:when #'guard)))
|
||||
|
@ -28,19 +32,23 @@
|
|||
;; intersperses "#:when #t" clauses to emulate the for* variants' semantics
|
||||
(define-splicing-syntax-class for*-clause
|
||||
;; single-valued seq-expr
|
||||
(pattern (var:annotated-name seq-expr:expr)
|
||||
#:with (expand ...) (list #`(var.ann-name
|
||||
(pattern (~and c (var:annotated-name seq-expr:expr))
|
||||
#:with (expand ...) (list (quasisyntax/loc
|
||||
#'c
|
||||
(var.ann-name
|
||||
#,(syntax-property #'seq-expr
|
||||
'type-ascription
|
||||
#'(Sequenceof var.ty)))
|
||||
#'(Sequenceof var.ty))))
|
||||
#'#:when #'#t))
|
||||
;; multi-valued seq-expr
|
||||
;; currently disabled because it triggers an internal error in the typechecker
|
||||
#;(pattern (((v:annotated-name) ...) seq-expr:expr)
|
||||
#:with (expand ...) (list #`((v.ann-name ...)
|
||||
#;(pattern (~and c (((v:annotated-name) ...) seq-expr:expr))
|
||||
#:with (expand ...) (list (quasisyntax/loc
|
||||
#'c
|
||||
((v.ann-name ...)
|
||||
#,(syntax-property #'seq-expr
|
||||
'type-ascription
|
||||
#'(Sequenceof (values v.ty ...))))
|
||||
#'(Sequenceof (values v.ty ...)))))
|
||||
#'#:when #'#t))
|
||||
;; when clause
|
||||
(pattern (~seq #:when guard:expr)
|
||||
|
|
|
@ -518,10 +518,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
|||
(quasisyntax/loc stx
|
||||
(for/lists (var.ann-name ...)
|
||||
(clause.expand ... ...)
|
||||
#,@(syntax-property
|
||||
#'(c ...)
|
||||
'type-ascription
|
||||
#'ty)))
|
||||
c ...))
|
||||
'type-ascription
|
||||
#'ty)]))
|
||||
(define-syntax (for/fold: stx)
|
||||
|
@ -534,10 +531,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
|||
(quasisyntax/loc stx
|
||||
(for/fold ((var.ann-name init) ...)
|
||||
(clause.expand ... ...)
|
||||
#,@(syntax-property
|
||||
#'(c ...)
|
||||
'type-ascription
|
||||
#'ty)))
|
||||
c ...))
|
||||
'type-ascription
|
||||
#'ty)]))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user