Closed gus-massa closed 4 years ago
I think the conversion probably needs something like a call to safe-single-value
make-nontail
to avoid moving a test expression into tail position.
Fixed. Do I merge this?
LGTM
In retrospect, make-nontail
isn't going to do anything because the transformation is only in a 'test
context. But it seems nicer to have for future reference.
It's applied in a 'test
context or when the test expression is boolean-valued?
.
I'm never sure about the details, but I think that something like
(lambda () (if (box? (car (current-continuation-attachments))) #t #f))
can cause a problem without make-nontail
.
Yes, you're right. I misread the or
around (eq? ctxt 'test)
as and
(which wouldn't make as much sense).
The first commit adds a reduction in cp0 of
(if <boolean> #t #f)
. It may help to reduce expressions like(and <boolean> <obviously-true>)
, for example(and (pair? x) (pair? y)
where the compiler knows thaty
is a pair.The second commit is unrelated. It's a fix to https://github.com/racket/racket/issues/2865 . I've send it as a PR upstream, but it is not merged yet and it would be nice to fix this in Racket7.6.