>From c06eac5fbdb09358e4572700868d34d44e5b9a64 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Sat, 19 May 2012 17:46:36 +0200 Subject: [PATCH] Do not allow closure compiler to access macros as first-class objects; this is not supported and not useful either. This fixes #852 --- eval.scm | 9 +++++---- tests/syntax-tests.scm | 13 ++++++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/eval.scm b/eval.scm index 9f7a9cf..10a9bec 100644 --- a/eval.scm +++ b/eval.scm @@ -247,10 +247,11 @@ ((symbol? x) (receive (i j) (lookup x e se) (cond ((not i) - (let ((var (if (not (assq x se)) - (and (not static) - (##sys#alias-global-hook j #f cntr)) - (or (##sys#get j '##core#primitive) j)))) + (let ((var (cond ((not (symbol? j)) x) ; syntax? + ((not (assq x se)) + (and (not static) + (##sys#alias-global-hook j #f cntr))) + (else (or (##sys#get j '##core#primitive) j))))) (when (and ##sys#unbound-in-eval (or (not var) (not (##sys#symbol-has-toplevel-binding? var)))) diff --git a/tests/syntax-tests.scm b/tests/syntax-tests.scm index 98dddf3..833d1ed 100644 --- a/tests/syntax-tests.scm +++ b/tests/syntax-tests.scm @@ -1030,4 +1030,15 @@ take ;; #816: compiler-syntax should obey hygiene in its rewrites (module foo () (import (prefix (only scheme map lambda list) ~)) - (~map (~lambda (y) y) (~list 1))) \ No newline at end of file + (~map (~lambda (y) y) (~list 1))) + +;; #852: renamed macros should not be returned as first-class +;; objects in the interpreter +(module renamed-macros (renamed-macro-not-firstclassed) + (import chicken scheme) + (define-syntax renamed-macro-not-firstclassed + (er-macro-transformer + (lambda (e r c) + `(,(r 'list) ,(r 'define)))))) + +(f (eval '(begin (import renamed-macros) (renamed-macro-not-firstclassed)))) \ No newline at end of file -- 1.7.9.1