expander: allow rename transformer to primitive in local-expanded
Closes #2119
This commit is contained in:
parent
c7318cab33
commit
09cdbc418c
|
@ -2261,6 +2261,18 @@
|
||||||
|
|
||||||
(test '(#t #t) dynamic-require ''uses-definition-context-and-local-expand-to-replace 'result)
|
(test '(#t #t) dynamic-require ''uses-definition-context-and-local-expand-to-replace 'result)
|
||||||
|
|
||||||
|
;; ----------------------------------------
|
||||||
|
;; Check that a rename transformer mapped to a
|
||||||
|
;; primitive is ok in the result of a local expansion
|
||||||
|
|
||||||
|
(module module-begin-with-a-rename-transformer racket/base
|
||||||
|
(require (for-syntax racket/base))
|
||||||
|
|
||||||
|
(define-syntax m (make-rename-transformer #'#%expression))
|
||||||
|
|
||||||
|
(begin-for-syntax
|
||||||
|
(local-expand #'(#%plain-module-begin (m #f)) 'module-begin '())))
|
||||||
|
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
|
|
||||||
(report-errs)
|
(report-errs)
|
||||||
|
|
|
@ -293,7 +293,11 @@
|
||||||
(define adj-s (avoid-current-expand-context (substitute-alternate-id s id) t ctx))
|
(define adj-s (avoid-current-expand-context (substitute-alternate-id s id) t ctx))
|
||||||
(log-expand ctx 'exit-macro s)
|
(log-expand ctx 'exit-macro s)
|
||||||
(expand adj-s ctx)]
|
(expand adj-s ctx)]
|
||||||
[(expand-context-should-not-encounter-macros? ctx)
|
[(and (expand-context-should-not-encounter-macros? ctx)
|
||||||
|
;; It's ok to have a rename transformer whose target
|
||||||
|
;; is a primitive form, so if it's a rename transformer,
|
||||||
|
;; delay the check for another step
|
||||||
|
(not (rename-transformer? t)))
|
||||||
(raise-syntax-error #f
|
(raise-syntax-error #f
|
||||||
"encountered a macro binding in form that should be fully expanded"
|
"encountered a macro binding in form that should be fully expanded"
|
||||||
s)]
|
s)]
|
||||||
|
|
|
@ -39603,7 +39603,9 @@ static const char *startup_source =
|
||||||
"(void)))"
|
"(void)))"
|
||||||
"(let-values(((adj-s186_0) adj-s_0)((ctx187_0) ctx_23))"
|
"(let-values(((adj-s186_0) adj-s_0)((ctx187_0) ctx_23))"
|
||||||
"(expand9.1 #f #f #f adj-s186_0 ctx187_0))))))"
|
"(expand9.1 #f #f #f adj-s186_0 ctx187_0))))))"
|
||||||
"(if(expand-context-should-not-encounter-macros? ctx_23)"
|
"(if(if(expand-context-should-not-encounter-macros? ctx_23)"
|
||||||
|
"(not(1/rename-transformer? t_54))"
|
||||||
|
" #f)"
|
||||||
"(let-values()"
|
"(let-values()"
|
||||||
"(raise-syntax-error$1"
|
"(raise-syntax-error$1"
|
||||||
" #f"
|
" #f"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user