expander: fix problem with syntax-local-expand-expression

Closes #1984
This commit is contained in:
Matthew Flatt 2018-03-12 07:11:31 -06:00
parent 2f930dd6f3
commit 994a4d4a35
3 changed files with 27 additions and 1 deletions

View File

@ -1882,6 +1882,28 @@
(module* a #f (bind-and-expand x x))
(module* b #f (bind-and-expand x (list x))))
;; ----------------------------------------
;; Make sure it's ok to produce an already-expanded
;; expression in a definition context
(module macro-with-syntax-local-expand-expression-in-a-definition-context racket/base
(require (for-syntax racket/base))
(define-syntax (m stx)
(syntax-case stx ()
[(_ e)
(let ()
(define-values (new-stx new-exp)
(syntax-local-expand-expression #'e #t))
new-exp)]))
(m 5)
(let ()
(define whatever 10)
(m (+ 1 2))
'ok))
;; ----------------------------------------
(report-errs)

View File

@ -209,6 +209,8 @@
" extra bindings or scopes in the current context")
(and (not (parsed? exp-s)) exp-s)))
(cond
[(expand-context-only-immediate? ctx)
s]
[(parsed? exp-s) exp-s]
[else
(define result-s (syntax-track-origin exp-s s))

View File

@ -38965,6 +38965,8 @@ static const char *startup_source =
" \" extra bindings or scopes in the current context\")"
"(if(not(parsed? exp-s_0)) exp-s_0 #f)))"
"(void))"
"(if(expand-context-only-immediate? ctx_18)"
"(let-values() s_45)"
"(if(parsed? exp-s_0)"
"(let-values() exp-s_0)"
"(let-values()"
@ -38977,7 +38979,7 @@ static const char *startup_source =
"(if(if(expand-context-to-parsed? ctx_18)(free-id-set-empty?(expand-context-stops ctx_18)) #f)"
"(let-values(((result-s115_0) result-s_1)((ctx116_0) ctx_18))"
"(expand7.1 #f #f #f #f result-s115_0 ctx116_0))"
" result-s_1)))))))))))"
" result-s_1))))))))))))"
"(define-values"
"(make-explicit)"
"(lambda(ctx_19 sym_62 s_307 disarmed-s_2)"