fix shaodwing problem in `module*'

This commit is contained in:
Matthew Flatt 2012-03-20 07:28:35 -06:00
parent 5551e287da
commit 47ae2b387a
2 changed files with 35 additions and 2 deletions

View File

@ -362,6 +362,39 @@
(test 3 dynamic-require '(submod 'module+-example-2 a b) 'x)
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check that various shaodwings are allowed:
(module subm-example-20 racket/base
(require (only-in racket/list third))
(provide first get-first second)
(define first 1)
(define (get-first) first) ;; verifies shadowing not mutation
(module* first #f
(define first 0) ;; shadows outer 'first'
(define f first)
(provide first f))
(define second 2)
(module* second #f
(require (only-in racket/list second))
(define s second)
(provide second s))
(module* third #f
(require (only-in mzlib/list third)) ; different binding than from `racket/list'
(define t third)
(provide third t)))
(test 1 dynamic-require ''subm-example-20 'first)
(test 1 (dynamic-require ''subm-example-20 'get-first))
(test 2 dynamic-require ''subm-example-20 'second)
(test 'b (dynamic-require '(submod 'subm-example-20 second) 'second) '(a b c))
(test 'b (dynamic-require '(submod 'subm-example-20 second) 's) '(a b c))
(test 'c (dynamic-require '(submod 'subm-example-20 third) 'third) '(a b c))
(test 'c (dynamic-require '(submod 'subm-example-20 third) 't) '(a b c))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(report-errs)

View File

@ -7017,7 +7017,7 @@ static void propagate_imports(Module_Begin_Expand_State *bxs,
v = scheme_add_rename(v, rn);
SCHEME_VEC_ELS(vec)[6] = v;
SCHEME_VEC_ELS(vec)[7] = SCHEME_VEC_ELS(super_vec)[7];
SCHEME_VEC_ELS(vec)[7] = scheme_true; /* can be shadowed */
SCHEME_VEC_ELS(vec)[8] = SCHEME_VEC_ELS(super_vec)[8];
scheme_hash_set(required, name, vec);
@ -7058,7 +7058,7 @@ static void propagate_imports(Module_Begin_Expand_State *bxs,
SCHEME_VEC_ELS(vec)[5] = name;
name = scheme_add_rename(name, rn);
SCHEME_VEC_ELS(vec)[6] = name;
SCHEME_VEC_ELS(vec)[7] = scheme_false;
SCHEME_VEC_ELS(vec)[7] = scheme_true; /* can be shadowed */
SCHEME_VEC_ELS(vec)[8] = phase;
name = SCHEME_STX_VAL(name); /* is this right? */