fix syntax taint errs produced by srcloc workaround in #%app

This commit is contained in:
Stephen Chang 2016-08-31 12:58:56 -04:00
parent 10a143a16d
commit 60fa8ab91f
3 changed files with 28 additions and 2 deletions

View File

@ -74,7 +74,7 @@
(define (transfer-stx-props new orig #:ctx [ctx new])
(datum->syntax ctx (syntax-e new) orig orig))
(define (replace-stx-loc old new)
(datum->syntax old (syntax-e old) new old))
(datum->syntax (syntax-disarm old #f) (syntax-e (syntax-disarm old #f)) new old))
;; set-stx-prop/preserved : Stx Any Any -> Stx
;; Returns a new syntax object with the prop property set to val. If preserved

View File

@ -1,3 +1,28 @@
2016-08-31 --------------------
Adding typed define/debug, debug (from query/debug), render (from lib/query):
- revealed problems with the way Rosette tracks source locations
- in query/debug.rkt: https://github.com/emina/rosette/blob/cb877b9094f368c5f392518e7538ae8a061433a2/rosette/query/debug.rkt#L38
- specifically, make-variable-like-transformer does not preserve src loc
properly, see: https://github.com/emina/rosette/issues/40
Workaround: manually set the src loc in #%app to surface program
- this causes taint problems bc rosette #%app uses syntax-rules, which taints
its output, which causes problems when we try to destructure it
minimal example:
#lang racket
(require (for-syntax syntax/parse))
(define-syntax-rule (mac x)
(#%app add1 x))
(define-syntax test
(syntax-parser
[(_ x)
#:with e (local-expand #'(mac x) 'expression null)
(datum->syntax #'e (syntax-e #'e))]))
(test 1)
- calling syntax-disarm on the expanded pieces of a Rosette #%app appears to
prevent the taint errors
2016-08-29 --------------------
Interesting parts of Typed Rosette
@ -28,6 +53,7 @@ TODOs:
- depends on macrotypes and rosette
- create version of turnstile that does not provide #%module-begin
- eg rename existing turnstile to turnstile/lang?
- remove my-this-syntax stx param
2016-08-25 --------------------

View File

@ -252,7 +252,7 @@
[ [e_arg e_arg- : τ_in] ...]
--------
;; TODO: use e_fn/progsrc- (currently causing "cannot use id tainted in macro trans" err)
[ [_ (ro:#%app e_fn- e_arg- ...) : τ_out]]]
[ [_ (ro:#%app e_fn/progsrc- e_arg- ...) : τ_out]]]
[(_ e_fn e_arg ...)
[ [e_fn e_fn- : (~Ccase-> ~! . (~and ty_fns ((~C→ . _) ...)))]]
#:with e_fn/progsrc- (replace-stx-loc #'e_fn- #'e_fn)