commit aca15dcc852d4b6291cc49f3cb821a8273abc3e3
parent f4f3354466b339ec62c5f5e138acc97beae99d6d
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Mon, 1 Aug 2016 13:23:24 -0600
Fix use of `namespace-require` that can create conflicts
The current expader's `namespace-require` has a bug that prevents
it from reporting a conclict when `(for-label <lib>)` creates
a conflict due to different provided bindings of the same name
at different phases from <lib>. Avoid depending on that bug.
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/scribble-lib/scribble/private/manual-bind.rkt b/scribble-lib/scribble/private/manual-bind.rkt
@@ -114,7 +114,15 @@
(let ([ns-id
(let ([ns (make-base-empty-namespace)])
(parameterize ([current-namespace ns])
- (namespace-require `(for-label ,lib))
+ ;; A `(namespace-require `(for-label ,lib))` can
+ ;; fail if `lib` provides different bindings of the
+ ;; same name at different phases. We can require phases
+ ;; 1 and 0 separately, in which case the phase-0
+ ;; binding shadows the phase-1 one in that case.
+ ;; This strategy only works for documenting bindings
+ ;; at phases 0 and 1, though.
+ (namespace-require `(just-meta 1 (for-label ,lib)))
+ (namespace-require `(just-meta 0 (for-label ,lib)))
(namespace-syntax-introduce (datum->syntax #f 'x))))])
(let ([checker
(lambda (id)