expander: repair literal syntax in test position of if
Fix mishandling of an expanded `if` where the test position is a syntax object. The expander's compiler pass from expanded objects to linkets knows that the syntax object isn't useful, but it tried to be helpful by preserving the syntax object's content as quoted --- and that content turns out not to be available, so the syntax object was replaced by #f, instead. Closes #3436
This commit is contained in:
parent
82744013d5
commit
1a1bad4e90
|
@ -82,6 +82,9 @@
|
|||
(syntax-test #'(+ 3 . 4))
|
||||
(syntax-test #'(apply + 1 . 2))
|
||||
|
||||
(test 'ok 'check-literal-quote-syntax-as-test (if (quote-syntax yes) 'ok 'bug!))
|
||||
(test 'ok2 'check-literal-quote-syntax-as-test (if (quote-syntax #f) 'ok2 'bug!))
|
||||
|
||||
(test 8 (lambda (x) (+ x x)) 4)
|
||||
(define reverse-subtract
|
||||
(lambda (x y) (- y x)))
|
||||
|
|
|
@ -31623,7 +31623,7 @@ static const char *startup_source =
|
|||
"(compile-quote-syntax"
|
||||
"(parsed-quote-syntax-datum p_0)"
|
||||
" cctx_0)"
|
||||
"(correlate~ s_0(list 'quote(syntax->datum$1 s_0)))))"
|
||||
"(correlate~ s_0 ''syntax)))"
|
||||
"(if(parsed-#%variable-reference? p_0)"
|
||||
"(let-values()"
|
||||
"(let-values(((id_0)"
|
||||
|
|
|
@ -38609,10 +38609,7 @@
|
|||
(compile-quote-syntax
|
||||
(parsed-quote-syntax-datum p3_0)
|
||||
cctx4_0)
|
||||
(let ((s-exp_0
|
||||
(list
|
||||
'quote
|
||||
(syntax->datum$1 s_0))))
|
||||
(let ((s-exp_0 ''syntax))
|
||||
s-exp_0))
|
||||
(if (|parsed-#%variable-reference?|
|
||||
p3_0)
|
||||
|
|
|
@ -106,7 +106,9 @@
|
|||
[(parsed-quote-syntax? p)
|
||||
(if result-used?
|
||||
(compile-quote-syntax (parsed-quote-syntax-datum p) cctx)
|
||||
(correlate~ s `(quote ,(syntax->datum s))))]
|
||||
;; Note: the datum form of `s` has probably been pruned away,
|
||||
;; so don't try to use it here:
|
||||
(correlate~ s `(quote syntax)))]
|
||||
[(parsed-#%variable-reference? p)
|
||||
(define id (parsed-#%variable-reference-id p))
|
||||
(correlate~ s
|
||||
|
|
Loading…
Reference in New Issue
Block a user