expander: fix code-inspector management during macro expansion

Specifically, don't incorrectly preserve the current macro's code
inspector when triggering another macro via `local-expand`.
This commit is contained in:
Matthew Flatt 2018-05-19 07:12:26 -06:00
parent 55011ce282
commit 628c177480
3 changed files with 1505 additions and 1470 deletions

View File

@ -2119,6 +2119,42 @@
(test 42 dynamic-require ''parent-internal-definition-contexts-do-add-bindings 'result)
;; ----------------------------------------
;; Make sure that changing the code expander disables syntax
;; disarming when it should
(parameterize ([current-namespace (make-base-namespace)]
[current-code-inspector (current-code-inspector)])
(eval
'(module disarm racket/base
(require (for-template racket/base))
(define (disarm s)
(unless (syntax-tainted? (car (syntax-e (syntax-disarm s #f))))
(error "disarm suceeded!"))
#''ok)
(provide disarm)))
(eval
'(module mapply racket/base
(require (for-syntax racket/base))
(provide mapply)
(define-syntax (mapply stx)
(syntax-case stx ()
[(_ m) #`(m #,(syntax-protect #'(x)))]))))
(current-code-inspector (make-inspector (current-code-inspector)))
(eval
'(module orig racket/base
(require (for-syntax racket/base
'disarm)
'mapply)
(define-syntax (m stx)
(syntax-case stx ()
[(_ e) (disarm #'e)]))
(mapply m))))
;; ----------------------------------------
(report-errs)

View File

@ -424,7 +424,7 @@
[current-namespace (namespace->namespace-at-phase
(expand-context-namespace ctx)
(add1 (expand-context-phase ctx)))]
[current-module-code-inspector (or insp-of-t (current-module-code-inspector))])
[current-module-code-inspector (or insp-of-t #;(current-module-code-inspector))])
(call-with-continuation-barrier
(lambda ()
;; Call the transformer!

File diff suppressed because it is too large Load Diff