From f3018385118bb880786e4bc8bdc9c80ba12ec2f5 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 29 Mar 2012 13:55:26 -0600 Subject: [PATCH] fix a syntax-object problem related to module bindings The immediate symptom was that `(provide (all-defined-out))' didn't work in a `module+'-based submodule, but there were also non-submodule ways to expose the problem. --- collects/tests/racket/module.rktl | 22 ++++++++++++++++++++++ collects/tests/racket/submodule.rktl | 10 ++++++++++ src/racket/src/compenv.c | 4 +++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/collects/tests/racket/module.rktl b/collects/tests/racket/module.rktl index ab079a5cd9..fcb14dc023 100644 --- a/collects/tests/racket/module.rktl +++ b/collects/tests/racket/module.rktl @@ -659,6 +659,28 @@ (require 'post-ex-rename-example-1) (go)) +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Check interaction of binding-context and mark: + +(module binding-context-a racket + (provide q) + + (define-syntax (q stx) + (syntax-case stx () + [(_ f) (with-syntax ([x (syntax-local-introduce #'x)]) + #'(f x))]))) + +(module binding-context-b racket + (require 'binding-context-a) + + (define-syntax-rule (go id) + (begin + (define id 5) + (define-syntax-rule (prov) + (provide id)) + (prov))) + + (q go)) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/collects/tests/racket/submodule.rktl b/collects/tests/racket/submodule.rktl index abd2da5849..afda6faf85 100644 --- a/collects/tests/racket/submodule.rktl +++ b/collects/tests/racket/submodule.rktl @@ -447,6 +447,16 @@ (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)) +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Check `all-defined-out': + +(module subm-all-defined-1 racket/base + (module+ main + (define x 10) + (provide (all-defined-out)))) + +(test 10 dynamic-require '(submod 'subm-all-defined-1 main) 'x) + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (report-errs) diff --git a/src/racket/src/compenv.c b/src/racket/src/compenv.c index 5b35652f59..cbf3eb9d20 100644 --- a/src/racket/src/compenv.c +++ b/src/racket/src/compenv.c @@ -1085,7 +1085,9 @@ Scheme_Object *scheme_tl_id_sym(Scheme_Env *env, Scheme_Object *id, Scheme_Objec marks = SCHEME_CAR(marks); } - if (!SCHEME_TRUEP(bdg)) + /* Treat #f and void values of bdg the same, since a void value is + the same #f, but ensure that we get this far: */ + if (SCHEME_FALSEP(bdg) || SCHEME_VOIDP(bdg)) bdg = NULL; /* Find a mapping that matches the longest tail of marks */