diff --git a/scheme/eval.sld b/scheme/eval.sld index 382960f5..72e0e206 100644 --- a/scheme/eval.sld +++ b/scheme/eval.sld @@ -882,7 +882,11 @@ (cond ((const? exp) exp) ((prim? exp) exp) - ((ref? exp) exp) + ((ref? exp) + (let ((renamed (assoc exp local-renamed))) + (if renamed + (cdr renamed) ;; Extract renamed symbol + exp))) ((quote? exp) exp) ;; TODO: rename all lambda formals and update rename-env accordingly. ;; will also require renaming refs later on here in expand... @@ -898,10 +902,7 @@ (map cdr a-lookup) ltype)) ) - `(lambda ,(lambda->formals exp) - ;; TODO: want this line instead of the above, but need to solve a crash - ;; when compiling unit tests first (!!!) - ;`(lambda ,new-formals ;,(lambda->formals exp) + `(lambda ,new-formals ;,(lambda->formals exp) ,@(_expand-body '() (lambda->exp exp) diff --git a/tests/let-syntax.scm b/tests/let-syntax.scm index f5b02837..d55c0cf5 100644 --- a/tests/let-syntax.scm +++ b/tests/let-syntax.scm @@ -4,7 +4,7 @@ (let ((x 'outer)) ;(let-syntax ((m (syntax-rules () ((m) x)))) (let ((x 'inner)) - (list)))) ;; Should be outer + (x)))) ;; Should be outer ; ) ;;;; Just testing, may want to remove this one once the recursive macro expansion works ;;; (define-syntax my-or2 (syntax-rules ()