diff --git a/pkgs/racket-test-core/tests/racket/optimize.rktl b/pkgs/racket-test-core/tests/racket/optimize.rktl index 15e264b433..2f0f45a524 100644 --- a/pkgs/racket-test-core/tests/racket/optimize.rktl +++ b/pkgs/racket-test-core/tests/racket/optimize.rktl @@ -6228,7 +6228,17 @@ (write (compile e) o) (parameterize ([read-accept-compiled #t]) (eval (read (open-input-bytes (get-output-bytes o))))) - ((dynamic-require ''uses-mutator-with-an-auto-field 'f) #f)) + ((dynamic-require ''uses-mutator-with-an-auto-field 'f) #f)) + +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Make sure that the optimizer doesn't discard a known error on the +;; right-hand side of a `letrec` + +(err/rt-test + (letrec-values ([() (list (3) the-val)] + [(the-val) 42]) + 777) + exn:fail:contract?) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/racket/src/racket/src/optimize.c b/racket/src/racket/src/optimize.c index fc88c42cd6..cb9c3ee514 100644 --- a/racket/src/racket/src/optimize.c +++ b/racket/src/racket/src/optimize.c @@ -7136,7 +7136,7 @@ static Scheme_Object *optimize_lets(Scheme_Object *form, Optimize_Info *info, in (values (if id e1 e2) ...) and then split the values call, since duplicating the id use and test is likely to pay off. */ if ((pre_body->count != 1) - && (found_escapes + && ((!is_rec && found_escapes) || (is_values_apply(value, pre_body->count, rhs_info, merge_skip_vars, 1) && ((!is_rec && no_mutable_bindings(pre_body)) /* If the right-hand side is omittable, then there are