Template variable expansion uses free-identifier=? instead of bound-identifier=?

Create issue
Issue #154 resolved
Takashi Kato repo owner created an issue

The following code returns incorrect values:

(import (rnrs))

(define-syntax bar
  (lambda (x)
    (syntax-case x ()
      ((_ (ts ...) (b ...))
       #'(let-syntax ((buz (lambda (x)
                             (syntax-case x ()
                               ((_ ts ...) #'(list ts ...))))))
           (buz b ...)))
      ((_ (t* ...) (b ...) a as ...)
       #'(bar (t* ... t) (b ...) as ...)))))

(bar () (1 2 3) 1 2 3)
;; -> (3 3 3)
;; must be (1 2 3)

This is because free-identifier=? returns #t with all temporary identifiers t.

Comments (2)

  1. Log in to comment