From 70c74b847680d3b239e591afa2e99c51a712980c Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Sun, 15 Dec 2013 19:04:59 -0500 Subject: [PATCH] =?UTF-8?q?Fix=20bound-identifier=3D=3F=20to=20compare=20b?= =?UTF-8?q?inding=20names,=20not=20just=20symbolic=20names.?= Fixes . * module/ice-9/psyntax.scm (bound-id=?): Use 'id-var-name' to compare binding names (gensyms), not just symbolic names. * module/ice-9/psyntax-pp.scm: Regenerate. * test-suite/tests/syntax.test: Add test. --- module/ice-9/psyntax-pp.scm | 1 + module/ice-9/psyntax.scm | 1 + test-suite/tests/syntax.test | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/module/ice-9/psyntax-pp.scm b/module/ice-9/psyntax-pp.scm index f5f764b0f..af5b61b75 100644 --- a/module/ice-9/psyntax-pp.scm +++ b/module/ice-9/psyntax-pp.scm @@ -484,6 +484,7 @@ (lambda (i j) (if (and (syntax-object? i) (syntax-object? j)) (and (eq? (syntax-object-expression i) (syntax-object-expression j)) + (eq? (id-var-name i '(())) (id-var-name j '(()))) (same-marks? (car (syntax-object-wrap i)) (car (syntax-object-wrap j)))) diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm index fa009d2d5..21dce1220 100644 --- a/module/ice-9/psyntax.scm +++ b/module/ice-9/psyntax.scm @@ -885,6 +885,7 @@ (if (and (syntax-object? i) (syntax-object? j)) (and (eq? (syntax-object-expression i) (syntax-object-expression j)) + (eq? (id-var-name i empty-wrap) (id-var-name j empty-wrap)) (same-marks? (wrap-marks (syntax-object-wrap i)) (wrap-marks (syntax-object-wrap j)))) (eq? i j)))) diff --git a/test-suite/tests/syntax.test b/test-suite/tests/syntax.test index 6fac0ba34..a608af6e2 100644 --- a/test-suite/tests/syntax.test +++ b/test-suite/tests/syntax.test @@ -1172,6 +1172,11 @@ (r 'outer)) #t))) +(pass-if "bound-identifier=?" + (let* ((x 1) (s1 #'x) + (x 2) (s2 #'x)) + (not (bound-identifier=? s1 s2)))) + (with-test-prefix "syntax-case" (pass-if-syntax-error "duplicate pattern variable"