Identifiers in patterns should be checked against literals using bound-identifier=?, not free-identifier=?.

This commit is contained in:
Alex Shinn 2017-07-22 19:50:56 +09:00
parent cdd5ffa406
commit e3678edbdc
2 changed files with 10 additions and 1 deletions

View file

@ -728,7 +728,7 @@
_let (list (list v x)) _let (list (list v x))
(cond (cond
((identifier? p) ((identifier? p)
(if (any (lambda (l) (compare p l)) lits) (if (memq p lits)
(list _and (list _and
(list _compare v (list _rename (list _quote p))) (list _compare v (list _rename (list _quote p)))
(k vars)) (k vars))

View file

@ -556,6 +556,15 @@
42) 42)
(test 42 (quux399))) (test 42 (quux399)))
(let-syntax
((m (syntax-rules ()
((m x) (let-syntax
((n (syntax-rules (k)
((n x) 'bound-identifier=?)
((n y) 'free-identifier=?))))
(n z))))))
(test 'bound-identifier=? (m k)))
(test-end) (test-end)
(test-begin "5 Program structure") (test-begin "5 Program structure")