fix require/expose for quoted module paths and submodules

closes PR 14331

Also, use namespace of use site, not rackunit (makes a difference
if rackunit is attached?)
This commit is contained in:
Ryan Culpepper 2014-02-03 20:10:17 -05:00
parent 0b934997b3
commit 06a10c0110

View File

@ -38,8 +38,6 @@
test-suite* test-suite*
check-regexp-match) check-regexp-match)
(define-namespace-anchor this-ns)
;; Requires a module and exposes some of its unprovided identifiers. ;; Requires a module and exposes some of its unprovided identifiers.
;; USAGE: (require/expose MODULE-NAME (IDS ...)) ;; USAGE: (require/expose MODULE-NAME (IDS ...))
;; where MODULE-NAME is as in the MzRacket manual (i.e., ;; where MODULE-NAME is as in the MzRacket manual (i.e.,
@ -53,13 +51,14 @@
(require (only-in mod)) (require (only-in mod))
(define-runtime-module-path the-resolved-mod mod) (define-runtime-module-path the-resolved-mod mod)
(define-values (id ...) (define-values (id ...)
(let ([the-mod (resolved-module-path-name the-resolved-mod)]) ;; Use the correct module-registry
;; Use the correct module-registry: (parameterize ((current-namespace
(parameterize ((current-namespace (namespace-anchor->namespace this-ns))) (variable-reference->namespace (#%variable-reference))))
;; Get the module namespace: ;; Make sure module the module is instantiated
(parameterize ((current-namespace (module->namespace the-mod))) (dynamic-require the-resolved-mod #f)
;; Use eval so id-macros (eg struct constructors, names w/ contracts) work: ;; Get the module namespace
(values (eval 'id) ...))))))])) (parameterize ((current-namespace (module->namespace the-resolved-mod)))
(values (eval 'id) ...)))))]))
(define-syntax test-suite* (define-syntax test-suite*
(syntax-rules () (syntax-rules ()