Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions private/expanders.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
(define (expander-stx? v)
(and (syntax? v)
(syntax-parse v
[(id:id _ ...) (expander? (maybe-syntax-local-value #'id))]
[(id:id . _) (expander? (maybe-syntax-local-value #'id))]
[_ #f])))

(define (expander-stx->expander expander-stx)
(syntax-parse expander-stx
[(id:id _ ...) (maybe-syntax-local-value #'id)]))
[(id:id . _) (maybe-syntax-local-value #'id)]))

(define (expander-stx-of-type? type v)
(and (expander-stx? v)
Expand Down
22 changes: 22 additions & 0 deletions test/test-call-with-dotted-last.rkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#lang racket

(require generic-syntax-expanders
(for-syntax syntax/parse)
rackunit)

(define-expander-type foo)

(define-foo-expander some-foo-expander
(syntax-parser
[(_ a:id b:id c:id . d:id) #'(d c b a)]))

(define-syntax (test-foo-expander stx)
(syntax-parse stx
[(_ e:expr)
#`'#,(expand-all-foo-expanders #'e)]))

(test-equal?
"Check that some-foo-expander accepts being called
when it is the first item of a dotted list"
(test-foo-expander (some-foo-expander x y z . t))
'(t z y x))