From b71b30cd4881479894715c6a4e3f984fe42dce94 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Mon, 15 May 2017 20:19:37 +0200 Subject: [PATCH 4/4] Keep the module module-defined-syntax-list updated When a macro is shadowed via a set! it is also removed from the macro-environment but not from the current module's export list. This leads to a compile-time error during the module finalization phase. --- core.scm | 4 +++- modules.scm | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core.scm b/core.scm index 5af0cd7c..a03cdf17 100644 --- a/core.scm +++ b/core.scm @@ -1115,7 +1115,9 @@ (sprintf "~aassignment to syntax `~S'" (if ln (sprintf "(~a) - " ln) "") var0)) - (when undefine-shadowed-macros (##sys#undefine-macro! var0))) + (when undefine-shadowed-macros + (##sys#undefine-macro! var0) + (##sys#unregister-syntax-export var0 (##sys#current-module)))) ((assq var0 (##sys#current-environment)) (warning (sprintf "~aassignment to imported value binding `~S'" diff --git a/modules.scm b/modules.scm index 2bf32c6c..a994aabd 100644 --- a/modules.scm +++ b/modules.scm @@ -223,6 +223,12 @@ mod (cons (cons sym val) (module-defined-syntax-list mod)))))) +(define (##sys#unregister-syntax-export sym mod) + (when mod + (set-module-defined-syntax-list! mod + (delete sym (module-defined-syntax-list mod) + (lambda (x y) (eq? x (car y))))))) + (define (register-undefined sym mod where) (when mod (let ((ul (module-undefined-list mod))) -- 2.13.0