expander: fix namespace-require/copy

This commit is contained in:
Matthew Flatt 2018-03-09 16:32:19 -07:00
parent 0d06ba2848
commit 3f2fd06cb0
3 changed files with 14 additions and 7 deletions

View File

@ -307,6 +307,16 @@
(namespace-require/constant 'racket/base)
(err/rt-test (eval '(define + -)) #rx"cannot change constant"))
;; ----------------------------------------
;; Check that `namespace-require/copy` does define variables
;; but doesn't bind as required
(parameterize ([current-namespace (make-base-empty-namespace)])
(namespace-require/copy 'racket/base)
(test (void) eval '(void))
(test #f identifier-binding (namespace-syntax-introduce (datum->syntax #f 'void)))
(test #t list? (identifier-binding (namespace-syntax-introduce (datum->syntax #f 'lambda)))))
;; ----------------------------------------
;; Check that bulk `require` replaces individual bindings

View File

@ -343,11 +343,10 @@
#:as-transformer? as-transformer?))
skip-bind?]
[else #f]))
(when (and adjusted-sym
copy-variable-phase-level
(when (and copy-variable-phase-level
(not as-transformer?)
(equal? provide-phase copy-variable-phase-level))
(copy-namespace-value m-ns adjusted-sym binding copy-variable-phase-level phase-shift
(copy-namespace-value m-ns sym binding copy-variable-phase-level phase-shift
copy-variable-as-constant?))
(and (not skip-bind?) adjusted-sym))))
;; Now that a bulk binding is in place, update to merge nominals:

View File

@ -25310,8 +25310,7 @@ static const char *startup_source =
"(let-values()"
" #f))))"
"(begin"
"(if(if adjusted-sym_0"
"(if copy-variable-phase-level_1"
"(if(if copy-variable-phase-level_1"
"(if(not"
" as-transformer?_3)"
"(equal?"
@ -25319,11 +25318,10 @@ static const char *startup_source =
" copy-variable-phase-level_1)"
" #f)"
" #f)"
" #f)"
"(let-values()"
"(copy-namespace-value"
" m-ns_10"
" adjusted-sym_0"
" sym_42"
" binding_16"
" copy-variable-phase-level_1"
" phase-shift_11"