From 65edffba15ae3b5c37acd316ef544d02f3019d2e Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Tue, 9 May 2017 15:29:04 +0200 Subject: [PATCH] Use the non-qualified variable name in env lookups By the time the checks are executed the `var` has been probably converted into its fully-qualified name, causing the lookups to fail unconditionally. --- core.scm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core.scm b/core.scm index 8f68e3fa..fae9ceca 100644 --- a/core.scm +++ b/core.scm @@ -1108,14 +1108,16 @@ `(let ((,var ,val)) (##core#debug-event "C_DEBUG_GLOBAL_ASSIGN" ',var) ,var)))) - (cond ((##sys#macro? var) + ;; Here `var` may be a fully-qualified symbol, we have to use the "raw" variable name as + ;; key into the environments in the following checks. + (cond ((##sys#macro? var0) (warning (sprintf "~aassigned global variable `~S' is syntax" (if ln (sprintf "(~a) - " ln) "") var)) (when undefine-shadowed-macros (##sys#undefine-macro! var))) ((and ##sys#notices-enabled - (assq var (##sys#current-environment))) + (assq var0 (##sys#current-environment))) (##sys#notice (sprintf "~aassignment to imported value binding `~S'" (if ln (sprintf "(~a) - " ln) "") -- 2.12.2