fix re-expansion of a simple #%module-body
form with submodules
Closes #1538
This commit is contained in:
parent
4683b023ab
commit
8a7852ebbf
|
@ -1905,6 +1905,38 @@ case of module-leve bindings; it doesn't cover local bindings.
|
|||
(namespace-syntax-introduce
|
||||
(dynamic-require ''provide-the-x-identifier 'x-id))))))
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Make sure that re-expansion of a simple (in the sense of `require`
|
||||
;; information kept for `module->namspace`) module body is ok
|
||||
|
||||
(module m racket/base
|
||||
(module mylang racket/base
|
||||
(require (for-syntax racket/base))
|
||||
(provide (rename-out [-#%module-begin #%module-begin]))
|
||||
(define-syntax (-#%module-begin stx)
|
||||
(syntax-case stx ()
|
||||
[(_ lng . rest)
|
||||
(with-syntax ([#%module-begin (datum->syntax #'lng '#%module-begin)])
|
||||
#`(#%plain-module-begin
|
||||
(require lng)
|
||||
(continue #%module-begin . rest)))]))
|
||||
(define-syntax (continue stx)
|
||||
(syntax-case stx ()
|
||||
[(_ lang-module-begin . rest)
|
||||
(let ([body-stx (local-expand
|
||||
#'(lang-module-begin . rest)
|
||||
'module-begin
|
||||
(list))])
|
||||
(syntax-case body-stx (#%plain-module-begin)
|
||||
[(#%plain-module-begin . mod-body)
|
||||
#`(begin . mod-body)]))])))
|
||||
|
||||
(module foo (submod ".." mylang) racket/base
|
||||
(module a-submod racket/base
|
||||
(define x 1)
|
||||
(provide x))
|
||||
(require 'a-submod)))
|
||||
|
||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(report-errs)
|
||||
|
|
|
@ -8778,7 +8778,7 @@ static Scheme_Object *do_module_begin(Scheme_Object *orig_form, Scheme_Comp_Env
|
|||
}
|
||||
}
|
||||
|
||||
if (*all_simple_bindings && env->genv->module->rn_stx) {
|
||||
if (*all_simple_bindings && env->genv->module->rn_stx && rec[drec].comp) {
|
||||
/* We will be able to reconstruct binding for `module->namespace`: */
|
||||
env->genv->module->rn_stx = scheme_true;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user