expander: don't duplicate properties in 'origin handling

One more take on the problem addressed by 990e1f1e30. This adjustment
avoids copying properties from the original form to the identifier
that is preserved in 'origin.
This commit is contained in:
Matthew Flatt 2018-11-10 07:13:04 -07:00
parent fca1c430af
commit 350ecf3d49
3 changed files with 12 additions and 11 deletions

View File

@ -424,13 +424,16 @@
[else #f]))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check that 'origin has the right source location
;; Check that 'origin has the right source location,
;; and that it doesn't have excessive properties
(let ()
(define m #'(module m racket/base
(define m #`(module m racket/base
(require (for-syntax racket/base))
(let ()
(define-values (x y) (values 1 2))
#,(syntax-property #`(define-values (x y) (values 1 2))
'on-form
'dv)
x)))
(define e (expand m))
(define dv-src
@ -463,7 +466,8 @@
list
(syntax-line dv-origin)
(syntax-column dv-origin)
(syntax-span dv-origin)))
(syntax-span dv-origin))
(test #f syntax-property dv-origin 'on-form))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check property tracking on `let[rec]-values` binding clauses

View File

@ -720,10 +720,9 @@
[(expand-context-to-parsed? ctx)
(and (or keep-for-parsed? keep-for-error?) (datum->syntax #f keep-e s s))]
[(and for-track? (pair? d) keep-e)
;; Use properties of `s`, but binding and source location of identifier
(define id (car d))
(syntax-rearm (datum->syntax (syntax-disarm id) keep-e id s)
id)]
;; Synthesize form to preserve just source and properties for tracking
;; without affecting the identifier that is kept in 'origin
(datum->syntax #f (list (car d)) s s)]
[else
(syntax-rearm (datum->syntax (syntax-disarm s) keep-e s s)
s)]))

View File

@ -40594,9 +40594,7 @@ static const char *startup_source =
"(datum->syntax$1 #f keep-e_0 s_0 s_0)"
" #f))"
"(if(if for-track?_0(if(pair? d_0) keep-e_0 #f) #f)"
"(let-values()"
"(let-values(((id_0)(car d_0)))"
"(syntax-rearm$1(datum->syntax$1(syntax-disarm$1 id_0) keep-e_0 id_0 s_0) id_0)))"
"(let-values()(datum->syntax$1 #f(list(car d_0)) s_0 s_0))"
"(let-values()"
"(syntax-rearm$1(datum->syntax$1(syntax-disarm$1 s_0) keep-e_0 s_0 s_0) s_0)))))))))))))))"
"(define-values"