defform: typeset ...+ as meta like ...

Within `defform`, `...+` should be treated like `...` and made to not
refer to a `...+` binding. (The identifier `...+` is bound by
`syntax/parse`, so it's not difficult to end up with a for-label
binding of `...+`.)
This commit is contained in:
Matthew Flatt 2018-06-01 17:43:34 +08:00
parent 48ce9faac6
commit 58b270adba

View File

@ -247,12 +247,16 @@
(define-for-syntax (strip-ellipsis-context a)
(define a-ellipsis (datum->syntax a '...))
(define a-ellipsis+ (datum->syntax a '...+))
(let loop ([a a])
(cond
[(identifier? a)
(if (free-identifier=? a a-ellipsis #f)
(datum->syntax #f '... a a)
a)]
(cond
[(free-identifier=? a a-ellipsis #f)
(datum->syntax #f '... a a)]
[(free-identifier=? a a-ellipsis+ #f)
(datum->syntax #f '...+ a a)]
[else a])]
[(syntax? a)
(datum->syntax a (loop (syntax-e a)) a a)]
[(pair? a)