fix binding table when shadowing imports

This commit is contained in:
Matthew Flatt 2015-12-09 20:34:23 -07:00
parent b7dd829a6f
commit f5d5277ae7
2 changed files with 20 additions and 1 deletions

View File

@ -2239,6 +2239,25 @@
[current-load-relative-directory (build-path dir "inner")])
(read i)))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check that shadowing doesn't create an ill-formed internal
;; representation of binding:
(let ()
;; Make introducers before namespace, so they have older scopes, which
;; means that bindings will be attached to the namespace's scope:
(define i1 (make-syntax-introducer))
(define i2 (make-syntax-introducer))
(define ns (make-base-namespace))
(eval `(define car 0) ns)
(eval `(define ,(i1 (datum->syntax #f 'car)) 1) ns)
(eval `(define ,(i2 (datum->syntax #f 'car)) 2) ns)
(eval `(require racket/base) ns) ; replaces plain `car` mapping
(write (compile-syntax
#`(quote-syntax #,(parameterize ([current-namespace ns])
(namespace-syntax-introduce (datum->syntax #f 'car)))))
(open-output-bytes)))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(report-errs)

View File

@ -2655,7 +2655,7 @@ static Scheme_Object *replace_matching_scopes(Scheme_Object *l, Scheme_Scope_Set
p = SCHEME_CDR(p);
while (c--) {
p = scheme_make_pair(SCHEME_CAR(l), p);
p = scheme_make_mutable_pair(SCHEME_CAR(l), p);
l = SCHEME_CDR(l);
}