~ chicken-core (chicken-5) 88138e982919382d4c98a6582217178015305ea1
commit 88138e982919382d4c98a6582217178015305ea1 Author: Evan Hanson <evhan@foldling.org> AuthorDate: Tue Oct 17 18:54:02 2017 +1300 Commit: Peter Bex <peter@more-magic.net> CommitDate: Wed Oct 18 14:05:15 2017 +0200 Move `begin-for-syntax' out of the default macro environment This moves the `begin-for-syntax' form out of expand.scm and into chicken-syntax.scm so that it isn't in the default macro environment, but rather part of (chicken base). Signed-off-by: Peter Bex <peter@more-magic.net> diff --git a/chicken-syntax.scm b/chicken-syntax.scm index afe62229..3abda348 100644 --- a/chicken-syntax.scm +++ b/chicken-syntax.scm @@ -266,6 +266,14 @@ (set! ##sys#chicken.base-macro-environment (let ((me0 (##sys#macro-environment))) +(##sys#extend-macro-environment + 'begin-for-syntax '() + (##sys#er-transformer + (lambda (x r c) + (##sys#check-syntax 'begin-for-syntax x '(_ . #(_ 0))) + (##sys#register-meta-expression `(##core#begin ,@(cdr x))) + `(##core#elaborationtimeonly (##core#begin ,@(cdr x)))))) + (##sys#extend-macro-environment 'define-constant '() diff --git a/eval.scm b/eval.scm index 37c5d8ca..983caa33 100644 --- a/eval.scm +++ b/eval.scm @@ -835,7 +835,6 @@ require-extension require-extension-for-syntax require-library - begin-for-syntax export module cond-expand diff --git a/expand.scm b/expand.scm index 1c66a01f..2482c92c 100644 --- a/expand.scm +++ b/expand.scm @@ -997,20 +997,12 @@ `(##core#require ,lib ,(module-requirement name))))) (cdr x))))))) -;; TODO Move this out of the initial environment: -(##sys#extend-macro-environment - 'begin-for-syntax '() - (##sys#er-transformer - (lambda (x r c) - (##sys#check-syntax 'begin-for-syntax x '(_ . #(_ 0))) - (##sys#register-meta-expression `(##core#begin ,@(cdr x))) - `(##core#elaborationtimeonly (##core#begin ,@(cdr x)))))) - (##sys#extend-macro-environment 'import-for-syntax '() (##sys#er-transformer (lambda (x r c) - `(,(r 'begin-for-syntax) (,(r 'import) ,@(cdr x)))))) + (##sys#register-meta-expression `(,(r 'import) ,@(cdr x))) + `(##core#elaborationtimeonly (,(r 'import) ,@(cdr x)))))) ;; The "initial" macro environment, containing only import forms (define ##sys#initial-macro-environment (##sys#macro-environment)) diff --git a/tests/module-tests.scm b/tests/module-tests.scm index 33a4b15e..e34cce4a 100644 --- a/tests/module-tests.scm +++ b/tests/module-tests.scm @@ -225,7 +225,7 @@ (test-equal "local module alias scope" (module m21 () - (import scheme) + (import scheme chicken) (begin-for-syntax ; XXX s.a. (##sys#register-module-alias 'm18 'm19)) (import m18) diff --git a/tests/scrutiny.expected b/tests/scrutiny.expected index 0495a6e6..d8c3b8fb 100644 --- a/tests/scrutiny.expected +++ b/tests/scrutiny.expected @@ -43,10 +43,10 @@ Warning: at toplevel: assignment of value of type `fixnum' to toplevel variable `car' does not match declared type `(forall (a) (procedure car ((pair a *)) a))' Warning: at toplevel: - expected a single result in `let' binding of `g20', but received 2 results + expected a single result in `let' binding of `g19', but received 2 results Warning: at toplevel: - in procedure call to `g20', expected a value of type `(procedure () *)' but was given a value of type `fixnum' + in procedure call to `g19', expected a value of type `(procedure () *)' but was given a value of type `fixnum' Note: in toplevel procedure `foo': expected a value of type boolean in conditional, but was given a value of type `(procedure bar () *)' which is always true:Trap