From d0cb74bef464accdc9fef6b67c03de27f00567bb Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sat, 25 Jun 2016 15:20:39 +0900 Subject: [PATCH] Identifiers in the template should only match pattern variables from the same expansion step. Fixes issue #366. --- .travis.yaml | 4 ---- lib/init-7.scm | 2 +- tests/r7rs-tests.scm | 10 ++++++++++ 3 files changed, 11 insertions(+), 5 deletions(-) delete mode 100644 .travis.yaml diff --git a/.travis.yaml b/.travis.yaml deleted file mode 100644 index 3bc83342..00000000 --- a/.travis.yaml +++ /dev/null @@ -1,4 +0,0 @@ -language: c -compiler: - - clang - - gcc diff --git a/lib/init-7.scm b/lib/init-7.scm index c27c7a75..d265789f 100644 --- a/lib/init-7.scm +++ b/lib/init-7.scm @@ -848,7 +848,7 @@ (cond ((identifier? t) (cond - ((find (lambda (v) (compare t (car v))) vars) + ((find (lambda (v) (eq? t (car v))) vars) => (lambda (cell) (if (<= (cdr cell) dim) t diff --git a/tests/r7rs-tests.scm b/tests/r7rs-tests.scm index 4555ecbd..103aa50c 100644 --- a/tests/r7rs-tests.scm +++ b/tests/r7rs-tests.scm @@ -499,6 +499,16 @@ #f) (test 1 x)) +(let () + (define-syntax foo + (syntax-rules () + ((foo bar y) + (define-syntax bar + (syntax-rules () + ((bar x) 'y)))))) + (foo bar x) + (test 'x (bar 1))) + (test-end) (test-begin "5 Program structure")