>From 26f74cdcca0fe5a6c19345067d32477cb145e9c5 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Mon, 15 May 2017 20:19:37 +0200 Subject: [PATCH 2/2] 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. Signed-off-by: Evan Hanson --- core.scm | 4 +++- modules.scm | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core.scm b/core.scm index 7c8a2f45..e73d207c 100644 --- a/core.scm +++ b/core.scm @@ -1115,7 +1115,9 @@ (warning (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 4f90cb11..27c3f6bb 100644 --- a/modules.scm +++ b/modules.scm @@ -224,6 +224,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.11.0