fix 'disappeared-use prperty added by `syntax'

Effectively preserve `syntax-original?' of added identifiers.
This commit is contained in:
Matthew Flatt 2012-08-03 14:45:02 -06:00
parent f64408fe60
commit f28e8a02d0
2 changed files with 22 additions and 1 deletions

View File

@ -574,7 +574,7 @@
(syntax-e id) (syntax-e id)
x)) x))
'disappeared-use 'disappeared-use
(car all-varss)) (map syntax-local-introduce (car all-varss)))
(loop (cdr vars) (cdr bindings) (cdr all-varss)))] (loop (cdr vars) (cdr bindings) (cdr all-varss)))]
[else (loop (cdr vars) (cdr bindings) (cdr all-varss))]))]) [else (loop (cdr vars) (cdr bindings) (cdr all-varss))]))])
(if (identifier? pattern) (if (identifier? pattern)

View File

@ -761,6 +761,27 @@
,e))) ,e)))
exn:fail?)) exn:fail?))
;; ----------------------------------------
;; Check that the `syntax' macro adds a
;; 'disappeared-use property that is
;; original (if it should be):
(parameterize ([current-namespace (make-base-namespace)])
(define stx (expand #'(with-syntax ([x 1]) #'x)))
(let sloop ([stx stx]
[in-prop? #f])
(cond
[(and (identifier? stx)
(eq? 'x (syntax-e stx)))
(when in-prop?
(test #t syntax-original? stx))]
[(syntax? stx)
(sloop (syntax-property stx 'disappeared-use) #t)
(sloop (syntax-e stx) in-prop?)]
[(pair? stx)
(sloop (car stx) in-prop?)
(sloop (cdr stx) in-prop?)])))
;; ---------------------------------------- ;; ----------------------------------------
(err/rt-test (syntax-local-lift-require 'abc #'def)) (err/rt-test (syntax-local-lift-require 'abc #'def))