fix dynamic-require with symbol to not make available

to match behavior in docs and racket 6.
This commit is contained in:
Michael Ballantyne 2018-04-11 11:30:26 -04:00 committed by Matthew Flatt
parent 8d08264b41
commit 4be2c523b6
3 changed files with 199 additions and 175 deletions

View File

@ -2456,6 +2456,29 @@ case of module-leve bindings; it doesn't cover local bindings.
(check '(begin-for-syntax (struct bar ())) #rx"later defined as syntax")
(check '(require (for-syntax (only-in racket/base [car bar]))) #rx"later bound differently"))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check that dynamic-require with a symbol argument
;; does not make the required module available for visits
(module shouldntvisit racket/base
(define x 5)
(provide x)
(require (for-syntax racket/base))
(define-for-syntax v #f)
(define-syntax (m stx)
(set! v #t)
#'(void))
(m)
(begin-for-syntax
(when (not v)
(error 'shouldntvisit "visited"))))
(module visitor racket/base
(require (for-syntax racket/base))
(begin-for-syntax
(dynamic-require ''shouldntvisit 'x))
(begin-for-syntax))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(report-errs)

View File

@ -70,7 +70,8 @@
(define binding (provided-as-binding binding/p))
(define ex-sym (module-binding-sym binding))
(define ex-phase (module-binding-phase binding))
(namespace-module-instantiate! ns mpi phase #:run-phase phase)
(namespace-module-instantiate! ns mpi phase #:run-phase phase
#:otherwise-available? #f)
(define ex-mod-name (module-path-index-resolve
(module-path-index-shift
(module-binding-module binding)

File diff suppressed because it is too large Load Diff