Various fixes. Closes FB case 189 Switch phc-graph to the packaged subtemplate.

This commit is contained in:
Georges Dupéron 2017-01-26 19:26:38 +01:00
parent 29ca612421
commit e4b3235a59
4 changed files with 213 additions and 168 deletions

View File

@ -205,7 +205,7 @@
ellipsis-depth
check-ellipsis-count]
)
(remove-duplicates acc #:key car))
(remove-duplicates acc bound-identifier=? #:key car))
#`(let ()
(derive bound binders unique-at-runtime-ids ellipsis-depth)
@ -315,7 +315,8 @@
#`(begin (define-temp-ids #:concise tmp-str binder-ddd)
(define temp-cached
(free-id-table-ref! (multi-hash-ref! derived-valvar-cache
'(unique-at-runtime-idᵢ )
(list unique-at-runtime-idᵢ
)
(make-free-id-table))
(quote-syntax bound)
(destructure-stx-list* #'tmp-ddd
@ -324,4 +325,4 @@
(derived-valvar (quote-syntax temp-cached)))
(define-syntax bound
(make-syntax-mapping 'ellipsis-depth (quote-syntax temp-derived)))
(define-pvars bound))))
(define-pvars bound))))

View File

@ -4,9 +4,15 @@
[subtemplate syntax]
[quasisubtemplate quasisyntax])
stxparse-info/parse
(except-in stxparse-info/parse/experimental/template
template
quasitemplate
template/loc
quasitemplate/loc)
stxparse-info/case
(subtract-in racket/syntax stxparse-info/case))
(provide (all-from-out subtemplate
stxparse-info/parse
stxparse-info/parse/experimental/template
stxparse-info/case
racket/syntax))

View File

@ -46,4 +46,10 @@ The @racketmodname[subtemplate/override] module re-provides
the reader shorthands @racket[#'…] and @racket[#`…].
The @racketmodname[subtemplate/override] module also re-provides
@racketmodname[stxparse-info/parse] and @racketmodname[stxparse-info/case].
@racketmodname[stxparse-info/parse] and @racketmodname[stxparse-info/case].
The @racketmodname[subtemplate/override] module also re-provides
@racketmodname[stxparse-info/parse/experimental/template], but without
@racket[template] and @racket[quasitemplate], which are remapped to their
@racket[sub] equivalents, and without @racket[template/loc] and
@racket[quasitemplate/loc], which do not have a @racket[sub] equivalent yet.

View File

@ -56,9 +56,9 @@
'(c d))
(check-equal? (syntax->datum (syntax-parse #'(a b c d)
[(_ xⱼ zᵢ )
(subtemplate (wᵢ ))]))
'(c/w d/w))
[(_ xⱼ zᵢ )
(subtemplate (wᵢ ))]))
'(c/w d/w))
(check-equal? (syntax->datum (syntax-case #'(a b c d) ()
[(_ xⱼ zᵢ )
@ -66,9 +66,9 @@
'(c/w d/w))
(check-equal? (syntax->datum (syntax-parse #'(a b c d)
[(_ xⱼ zᵢ )
(subtemplate (kⱼ wᵢ ))]))
'(b/k c/w d/w))
[(_ xⱼ zᵢ )
(subtemplate (kⱼ wᵢ ))]))
'(b/k c/w d/w))
(check-equal? (syntax->datum (syntax-case #'(a b c d) ()
[(_ xⱼ zᵢ )
@ -76,169 +76,175 @@
'(b/k c/w d/w))
(check-equal? (syntax->datum (syntax-parse #'(a b c d)
[(_ xⱼ zᵢ )
(subtemplate (xⱼ kⱼ (zᵢ wᵢ) ))]))
'(b b/k (c c/w) (d d/w)))
[(_ xⱼ zᵢ )
(subtemplate (xⱼ kⱼ (zᵢ wᵢ) ))]))
'(b b/k (c c/w) (d d/w)))
(check-equal? (syntax->datum (syntax-case #'(a b c d) ()
[(_ xⱼ zᵢ )
(subtemplate (xⱼ kⱼ (wᵢ zᵢ) ))]))
'(b b/k (c/w c) (d/w d)))
;; With yᵢ appearing twice:
(check-equal? (syntax->datum (syntax-case #'(a b c) ()
[(xᵢ )
(subtemplate (yᵢ yᵢ ))]))
'(a/y b/y c/y a/y b/y c/y))
#;(let ()
(syntax-parse #'a #;(syntax-parse #'(a b c d)
[(_ xⱼ zᵢ )
(list (subtemplate ([xⱼ wⱼ] foo [zᵢ pᵢ] ))
(subtemplate ([xⱼ wⱼ] foo [zᵢ pᵢ] )))])
[_ #;(([x1 w1] foo1 [z1 p1] [zz1 pp1])
([x2 w2] foo2 [z2 p2] [zz2 pp2]))
(check bound-identifier=? #'x1 #'x2)]))
(syntax-parse #'a #;(syntax-parse #'(a b c d)
[(_ xⱼ zᵢ )
(list (subtemplate ([xⱼ wⱼ] foo [zᵢ pᵢ] ))
(subtemplate ([xⱼ wⱼ] foo [zᵢ pᵢ] )))])
[_ #;(([x1 w1] foo1 [z1 p1] [zz1 pp1])
([x2 w2] foo2 [z2 p2] [zz2 pp2]))
(check bound-identifier=? #'x1 #'x2)]))
(syntax-parse (syntax-parse #'(a b c d)
[(_ xⱼ zᵢ )
(list (subtemplate ([xⱼ wⱼ] foo [zᵢ pᵢ] ))
(subtemplate ([xⱼ wⱼ] foo [zᵢ pᵢ] )))])
[(([x1 w1] foo1 [z1 p1] [zz1 pp1])
([x2 w2] foo2 [z2 p2] [zz2 pp2]))
(check bound-identifier=? #'x1 #'x2)
(check bound-identifier=? #'w1 #'w2)
(check bound-identifier=? #'foo1 #'foo2)
(check bound-identifier=? #'z1 #'z2)
(check bound-identifier=? #'p1 #'p2)
(check bound-identifier=? #'zz1 #'zz2)
(check bound-identifier=? #'pp1 #'pp2)
[(_ xⱼ zᵢ )
(list (subtemplate ([xⱼ wⱼ] foo [zᵢ pᵢ] ))
(subtemplate ([xⱼ wⱼ] foo [zᵢ pᵢ] )))])
[(([x1 w1] foo1 [z1 p1] [zz1 pp1])
([x2 w2] foo2 [z2 p2] [zz2 pp2]))
(check bound-identifier=? #'x1 #'x2)
(check bound-identifier=? #'w1 #'w2)
(check bound-identifier=? #'foo1 #'foo2)
(check bound-identifier=? #'z1 #'z2)
(check bound-identifier=? #'p1 #'p2)
(check bound-identifier=? #'zz1 #'zz2)
(check bound-identifier=? #'pp1 #'pp2)
(check bound-identifier=? #'x1 #'b)
(check bound-identifier=? #'z1 #'c)
(check bound-identifier=? #'zz1 #'d)
(check bound-identifier=? #'x1 #'b)
(check bound-identifier=? #'z1 #'c)
(check bound-identifier=? #'zz1 #'d)
(check bound-identifier=? #'x2 #'b)
(check bound-identifier=? #'z2 #'c)
(check bound-identifier=? #'zz2 #'d)
(check bound-identifier=? #'x2 #'b)
(check bound-identifier=? #'z2 #'c)
(check bound-identifier=? #'zz2 #'d)
;; The *1 are all different:
(check bound-identifier=? #'x1 #'x1)
(check ( not bound-identifier=?) #'x1 #'w1)
(check ( not bound-identifier=?) #'x1 #'foo1)
(check ( not bound-identifier=?) #'x1 #'z1)
(check ( not bound-identifier=?) #'x1 #'p1)
(check ( not bound-identifier=?) #'x1 #'zz1)
(check ( not bound-identifier=?) #'x1 #'pp1)
;; The *1 are all different:
(check bound-identifier=? #'x1 #'x1)
(check ( not bound-identifier=?) #'x1 #'w1)
(check ( not bound-identifier=?) #'x1 #'foo1)
(check ( not bound-identifier=?) #'x1 #'z1)
(check ( not bound-identifier=?) #'x1 #'p1)
(check ( not bound-identifier=?) #'x1 #'zz1)
(check ( not bound-identifier=?) #'x1 #'pp1)
(check ( not bound-identifier=?) #'w1 #'x1)
(check bound-identifier=? #'w1 #'w1)
(check ( not bound-identifier=?) #'w1 #'foo1)
(check ( not bound-identifier=?) #'w1 #'z1)
(check ( not bound-identifier=?) #'w1 #'p1)
(check ( not bound-identifier=?) #'w1 #'zz1)
(check ( not bound-identifier=?) #'w1 #'pp1)
(check ( not bound-identifier=?) #'w1 #'x1)
(check bound-identifier=? #'w1 #'w1)
(check ( not bound-identifier=?) #'w1 #'foo1)
(check ( not bound-identifier=?) #'w1 #'z1)
(check ( not bound-identifier=?) #'w1 #'p1)
(check ( not bound-identifier=?) #'w1 #'zz1)
(check ( not bound-identifier=?) #'w1 #'pp1)
(check ( not bound-identifier=?) #'foo1 #'x1)
(check ( not bound-identifier=?) #'foo1 #'w1)
(check bound-identifier=? #'foo1 #'foo1)
(check ( not bound-identifier=?) #'foo1 #'z1)
(check ( not bound-identifier=?) #'foo1 #'p1)
(check ( not bound-identifier=?) #'foo1 #'zz1)
(check ( not bound-identifier=?) #'foo1 #'pp1)
(check ( not bound-identifier=?) #'foo1 #'x1)
(check ( not bound-identifier=?) #'foo1 #'w1)
(check bound-identifier=? #'foo1 #'foo1)
(check ( not bound-identifier=?) #'foo1 #'z1)
(check ( not bound-identifier=?) #'foo1 #'p1)
(check ( not bound-identifier=?) #'foo1 #'zz1)
(check ( not bound-identifier=?) #'foo1 #'pp1)
(check ( not bound-identifier=?) #'z1 #'x1)
(check ( not bound-identifier=?) #'z1 #'w1)
(check ( not bound-identifier=?) #'z1 #'foo1)
(check bound-identifier=? #'z1 #'z1)
(check ( not bound-identifier=?) #'z1 #'p1)
(check ( not bound-identifier=?) #'z1 #'zz1)
(check ( not bound-identifier=?) #'z1 #'pp1)
(check ( not bound-identifier=?) #'z1 #'x1)
(check ( not bound-identifier=?) #'z1 #'w1)
(check ( not bound-identifier=?) #'z1 #'foo1)
(check bound-identifier=? #'z1 #'z1)
(check ( not bound-identifier=?) #'z1 #'p1)
(check ( not bound-identifier=?) #'z1 #'zz1)
(check ( not bound-identifier=?) #'z1 #'pp1)
(check ( not bound-identifier=?) #'p1 #'x1)
(check ( not bound-identifier=?) #'p1 #'w1)
(check ( not bound-identifier=?) #'p1 #'foo1)
(check ( not bound-identifier=?) #'p1 #'z1)
(check bound-identifier=? #'p1 #'p1)
(check ( not bound-identifier=?) #'p1 #'zz1)
(check ( not bound-identifier=?) #'p1 #'pp1)
(check ( not bound-identifier=?) #'p1 #'x1)
(check ( not bound-identifier=?) #'p1 #'w1)
(check ( not bound-identifier=?) #'p1 #'foo1)
(check ( not bound-identifier=?) #'p1 #'z1)
(check bound-identifier=? #'p1 #'p1)
(check ( not bound-identifier=?) #'p1 #'zz1)
(check ( not bound-identifier=?) #'p1 #'pp1)
(check ( not bound-identifier=?) #'zz1 #'x1)
(check ( not bound-identifier=?) #'zz1 #'w1)
(check ( not bound-identifier=?) #'zz1 #'foo1)
(check ( not bound-identifier=?) #'zz1 #'z1)
(check ( not bound-identifier=?) #'zz1 #'p1)
(check bound-identifier=? #'zz1 #'zz1)
(check ( not bound-identifier=?) #'zz1 #'pp1)
(check ( not bound-identifier=?) #'zz1 #'x1)
(check ( not bound-identifier=?) #'zz1 #'w1)
(check ( not bound-identifier=?) #'zz1 #'foo1)
(check ( not bound-identifier=?) #'zz1 #'z1)
(check ( not bound-identifier=?) #'zz1 #'p1)
(check bound-identifier=? #'zz1 #'zz1)
(check ( not bound-identifier=?) #'zz1 #'pp1)
(check ( not bound-identifier=?) #'pp1 #'x1)
(check ( not bound-identifier=?) #'pp1 #'w1)
(check ( not bound-identifier=?) #'pp1 #'foo1)
(check ( not bound-identifier=?) #'pp1 #'z1)
(check ( not bound-identifier=?) #'pp1 #'p1)
(check ( not bound-identifier=?) #'pp1 #'zz1)
(check bound-identifier=? #'pp1 #'pp1)
(check ( not bound-identifier=?) #'pp1 #'x1)
(check ( not bound-identifier=?) #'pp1 #'w1)
(check ( not bound-identifier=?) #'pp1 #'foo1)
(check ( not bound-identifier=?) #'pp1 #'z1)
(check ( not bound-identifier=?) #'pp1 #'p1)
(check ( not bound-identifier=?) #'pp1 #'zz1)
(check bound-identifier=? #'pp1 #'pp1)
;; The *2 are all different:
(check bound-identifier=? #'x2 #'x2)
(check ( not bound-identifier=?) #'x2 #'w2)
(check ( not bound-identifier=?) #'x2 #'foo2)
(check ( not bound-identifier=?) #'x2 #'z2)
(check ( not bound-identifier=?) #'x2 #'p2)
(check ( not bound-identifier=?) #'x2 #'zz2)
(check ( not bound-identifier=?) #'x2 #'pp2)
;; The *2 are all different:
(check bound-identifier=? #'x2 #'x2)
(check ( not bound-identifier=?) #'x2 #'w2)
(check ( not bound-identifier=?) #'x2 #'foo2)
(check ( not bound-identifier=?) #'x2 #'z2)
(check ( not bound-identifier=?) #'x2 #'p2)
(check ( not bound-identifier=?) #'x2 #'zz2)
(check ( not bound-identifier=?) #'x2 #'pp2)
(check ( not bound-identifier=?) #'w2 #'x2)
(check bound-identifier=? #'w2 #'w2)
(check ( not bound-identifier=?) #'w2 #'foo2)
(check ( not bound-identifier=?) #'w2 #'z2)
(check ( not bound-identifier=?) #'w2 #'p2)
(check ( not bound-identifier=?) #'w2 #'zz2)
(check ( not bound-identifier=?) #'w2 #'pp2)
(check ( not bound-identifier=?) #'w2 #'x2)
(check bound-identifier=? #'w2 #'w2)
(check ( not bound-identifier=?) #'w2 #'foo2)
(check ( not bound-identifier=?) #'w2 #'z2)
(check ( not bound-identifier=?) #'w2 #'p2)
(check ( not bound-identifier=?) #'w2 #'zz2)
(check ( not bound-identifier=?) #'w2 #'pp2)
(check ( not bound-identifier=?) #'foo2 #'x2)
(check ( not bound-identifier=?) #'foo2 #'w2)
(check bound-identifier=? #'foo2 #'foo2)
(check ( not bound-identifier=?) #'foo2 #'z2)
(check ( not bound-identifier=?) #'foo2 #'p2)
(check ( not bound-identifier=?) #'foo2 #'zz2)
(check ( not bound-identifier=?) #'foo2 #'pp2)
(check ( not bound-identifier=?) #'foo2 #'x2)
(check ( not bound-identifier=?) #'foo2 #'w2)
(check bound-identifier=? #'foo2 #'foo2)
(check ( not bound-identifier=?) #'foo2 #'z2)
(check ( not bound-identifier=?) #'foo2 #'p2)
(check ( not bound-identifier=?) #'foo2 #'zz2)
(check ( not bound-identifier=?) #'foo2 #'pp2)
(check ( not bound-identifier=?) #'z2 #'x2)
(check ( not bound-identifier=?) #'z2 #'w2)
(check ( not bound-identifier=?) #'z2 #'foo2)
(check bound-identifier=? #'z2 #'z2)
(check ( not bound-identifier=?) #'z2 #'p2)
(check ( not bound-identifier=?) #'z2 #'zz2)
(check ( not bound-identifier=?) #'z2 #'pp2)
(check ( not bound-identifier=?) #'z2 #'x2)
(check ( not bound-identifier=?) #'z2 #'w2)
(check ( not bound-identifier=?) #'z2 #'foo2)
(check bound-identifier=? #'z2 #'z2)
(check ( not bound-identifier=?) #'z2 #'p2)
(check ( not bound-identifier=?) #'z2 #'zz2)
(check ( not bound-identifier=?) #'z2 #'pp2)
(check ( not bound-identifier=?) #'p2 #'x2)
(check ( not bound-identifier=?) #'p2 #'w2)
(check ( not bound-identifier=?) #'p2 #'foo2)
(check ( not bound-identifier=?) #'p2 #'z2)
(check bound-identifier=? #'p2 #'p2)
(check ( not bound-identifier=?) #'p2 #'zz2)
(check ( not bound-identifier=?) #'p2 #'pp2)
(check ( not bound-identifier=?) #'p2 #'x2)
(check ( not bound-identifier=?) #'p2 #'w2)
(check ( not bound-identifier=?) #'p2 #'foo2)
(check ( not bound-identifier=?) #'p2 #'z2)
(check bound-identifier=? #'p2 #'p2)
(check ( not bound-identifier=?) #'p2 #'zz2)
(check ( not bound-identifier=?) #'p2 #'pp2)
(check ( not bound-identifier=?) #'zz2 #'x2)
(check ( not bound-identifier=?) #'zz2 #'w2)
(check ( not bound-identifier=?) #'zz2 #'foo2)
(check ( not bound-identifier=?) #'zz2 #'z2)
(check ( not bound-identifier=?) #'zz2 #'p2)
(check bound-identifier=? #'zz2 #'zz2)
(check ( not bound-identifier=?) #'zz2 #'pp2)
(check ( not bound-identifier=?) #'zz2 #'x2)
(check ( not bound-identifier=?) #'zz2 #'w2)
(check ( not bound-identifier=?) #'zz2 #'foo2)
(check ( not bound-identifier=?) #'zz2 #'z2)
(check ( not bound-identifier=?) #'zz2 #'p2)
(check bound-identifier=? #'zz2 #'zz2)
(check ( not bound-identifier=?) #'zz2 #'pp2)
(check ( not bound-identifier=?) #'pp2 #'x2)
(check ( not bound-identifier=?) #'pp2 #'w2)
(check ( not bound-identifier=?) #'pp2 #'foo2)
(check ( not bound-identifier=?) #'pp2 #'z2)
(check ( not bound-identifier=?) #'pp2 #'p2)
(check ( not bound-identifier=?) #'pp2 #'zz2)
(check bound-identifier=? #'pp2 #'pp2)])
(check ( not bound-identifier=?) #'pp2 #'x2)
(check ( not bound-identifier=?) #'pp2 #'w2)
(check ( not bound-identifier=?) #'pp2 #'foo2)
(check ( not bound-identifier=?) #'pp2 #'z2)
(check ( not bound-identifier=?) #'pp2 #'p2)
(check ( not bound-identifier=?) #'pp2 #'zz2)
(check bound-identifier=? #'pp2 #'pp2)])
(syntax-parse (syntax-parse #'(a b c)
[(xᵢ )
(define flob (quasisubtemplate (zᵢ )))
(quasisubtemplate (yᵢ
#,flob
zᵢ ))])
#,flob
zᵢ ))])
[(a1 b1 c1 (a2 b2 c2) a3 b3 c3)
(check bound-identifier=? #'a2 #'a3)
(check bound-identifier=? #'b2 #'b3)
@ -250,8 +256,8 @@
(syntax-parse (syntax-parse #'(a b c)
[(xᵢ )
(quasisubtemplate (yᵢ
#,(quasisubtemplate (zᵢ ))
zᵢ ))])
#,(quasisubtemplate (zᵢ ))
zᵢ ))])
[(a1 b1 c1 (a2 b2 c2) a3 b3 c3)
(check bound-identifier=? #'a2 #'a3)
(check bound-identifier=? #'b2 #'b3)
@ -264,8 +270,8 @@
[(xᵢ )
(define flob (syntax-parse #'d [d (quasisubtemplate (zᵢ ))]))
(quasisubtemplate (yᵢ
#,flob
zᵢ ))])
#,flob
zᵢ ))])
[(a1 b1 c1 (a2 b2 c2) a3 b3 c3)
(check bound-identifier=? #'a2 #'a3)
(check bound-identifier=? #'b2 #'b3)
@ -277,9 +283,9 @@
(syntax-parse (syntax-parse #'(a b c)
[(xᵢ )
(quasisubtemplate (yᵢ
#,(syntax-parse #'d
[d (quasisubtemplate (zᵢ ))])
zᵢ ))])
#,(syntax-parse #'d
[d (quasisubtemplate (zᵢ ))])
zᵢ ))])
[(a1 b1 c1 (a2 b2 c2) a3 b3 c3)
(check bound-identifier=? #'a2 #'a3)
(check bound-identifier=? #'b2 #'b3)
@ -291,11 +297,11 @@
(syntax-parse (syntax-parse #'(a b c)
[(xᵢ )
(quasisubtemplate (yᵢ
#,(syntax-parse #'d
[d (quasisubtemplate (zᵢ ))])
#,(syntax-parse #'d
[d (quasisubtemplate (zᵢ ))])
zᵢ ))])
#,(syntax-parse #'d
[d (quasisubtemplate (zᵢ ))])
#,(syntax-parse #'d
[d (quasisubtemplate (zᵢ ))])
zᵢ ))])
[(a1 b1 c1 (a2 b2 c2) (a3 b3 c3) a4 b4 c4)
(check bound-identifier=? #'a2 #'a3)
(check bound-identifier=? #'b2 #'b3)
@ -316,11 +322,11 @@
(syntax-parse (syntax-parse #'(a b c)
[(xᵢ )
(quasisubtemplate (yᵢ
#,(syntax-parse #'d
[d (quasisubtemplate (kᵢ ))])
#,(syntax-parse #'d
[d (quasisubtemplate (kᵢ ))])
zᵢ ))])
#,(syntax-parse #'d
[d (quasisubtemplate (kᵢ ))])
#,(syntax-parse #'d
[d (quasisubtemplate (kᵢ ))])
zᵢ ))])
[(a1 b1 c1 (a2 b2 c2) (a3 b3 c3) a4 b4 c4)
(check bound-identifier=? #'a2 #'a3)
(check bound-identifier=? #'b2 #'b3)
@ -351,21 +357,21 @@
(syntax-parse #'(a b c)
[(xᵢ )
(quasisubtemplate (yᵢ
#,(syntax-parse #'(d)
[(pᵢ ) (quasisubtemplate (pᵢ zᵢ ))])
;; GIVES WRONG ID (re-uses the one above, shouldn't):
#,(syntax-parse #'(e)
[(pᵢ ) (quasisubtemplate (pᵢ zᵢ ))])
wᵢ ))]))
#,(syntax-parse #'(d)
[(pᵢ ) (quasisubtemplate (pᵢ zᵢ ))])
;; GIVES WRONG ID (re-uses the one above, shouldn't):
#,(syntax-parse #'(e)
[(pᵢ ) (quasisubtemplate (pᵢ zᵢ ))])
wᵢ ))]))
(syntax-parse (syntax-parse #'(a b c)
[(xᵢ )
(quasisubtemplate (yᵢ
#,(syntax-parse #'d
[zᵢ (quasisubtemplate (zᵢ))])
#,(syntax-parse #'d
[zᵢ (quasisubtemplate (zᵢ))])
zᵢ ))])
#,(syntax-parse #'d
[zᵢ (quasisubtemplate (zᵢ))])
#,(syntax-parse #'d
[zᵢ (quasisubtemplate (zᵢ))])
zᵢ ))])
[(y yy yyy (d1) (d2) z zz zzz)
(check bound-identifier=? #'d1 #'d2)
@ -644,3 +650,29 @@
(check bound-identifier=? #'p1 #'p2)
(check bound-identifier=? #'zz1 #'zz2)
(check bound-identifier=? #'pp1 #'pp2)])
;; Check that the derived values are NOT cached across runs of the same
;; pattern+template (GH bug #1).
(check-equal? (map (λ (v)
(syntax->datum
(syntax-parse v
[(xᵢ ) (subtemplate (yᵢ ))])))
(list #'[] #'[a] #'[a b] #'[c d e f]))
'([] [a/y] [a/y b/y] [c/y d/y e/y f/y]))
(check-equal? (map (λ (v)
(syntax->datum
(syntax-parse v
[(xᵢ ) (subtemplate (xᵢ yᵢ ))])))
(list #'[] #'[a] #'[a b] #'[c d e f]))
'([] [a a/y] [a b a/y b/y] [c d e f c/y d/y e/y f/y]))
(check-equal? (map (λ (v)
(syntax->datum
(syntax-parse v
[(xᵢ ) (subtemplate ([xᵢ yᵢ] ))])))
(list #'[] #'[a] #'[a b] #'[c d e f]))
'(()
([a a/y])
([a a/y] [b b/y])
([c c/y] [d d/y] [e e/y] [f f/y])))