diff --git a/pkgs/racket-doc/scribblings/reference/stx-trans.scrbl b/pkgs/racket-doc/scribblings/reference/stx-trans.scrbl index 04409e480a..176c1d5bc5 100644 --- a/pkgs/racket-doc/scribblings/reference/stx-trans.scrbl +++ b/pkgs/racket-doc/scribblings/reference/stx-trans.scrbl @@ -1013,7 +1013,7 @@ macro expansion in the current definition context. In a @tech{syntax transformer} that runs in a non-expression context and forces the expansion of subforms with @racket[local-expand], use @racket[syntax-local-identifier-as-binding] on an identifier from the -expansion before moving it into a binding position or comparing with +expansion before moving it into a binding position or comparing it with @racket[bound-identifier=?]. Otherwise, the results can be inconsistent with the way that @racket[define] works in the same definition context. diff --git a/pkgs/racket-test-core/tests/racket/optimize.rktl b/pkgs/racket-test-core/tests/racket/optimize.rktl index fe8a0e9d9a..f192ffc78b 100644 --- a/pkgs/racket-test-core/tests/racket/optimize.rktl +++ b/pkgs/racket-test-core/tests/racket/optimize.rktl @@ -6619,6 +6619,28 @@ n)]) (lambda (x) (h x))))) +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Regression test related to single-use variables +;; and disabled inlining + +(parameterize ([compile-context-preservation-enabled #t] + [current-namespace (make-base-namespace)]) + (void + (compile + '(module m racket/base + (letrec ([f (lambda () 0)] + [g (let ([g2 + (lambda () + (let ([x (f)]) + (list (lambda () x) h)))]) + g2)] + [h (letrec ([loop + (lambda () + (let ([y (g)]) + (list y loop)))]) + loop)]) + h))))) + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (report-errs) diff --git a/racket/src/racket/src/optimize.c b/racket/src/racket/src/optimize.c index a933a91fe7..8eb0199421 100644 --- a/racket/src/racket/src/optimize.c +++ b/racket/src/racket/src/optimize.c @@ -9622,7 +9622,7 @@ Scheme_Object *optimize_expr(Scheme_Object *expr, Optimize_Info *info, int conte int save_fuel = info->inline_fuel, save_no_types = info->no_types; int save_vclock, save_aclock, save_kclock, save_sclock; info->size -= 1; - info->inline_fuel = 0; /* no more inlining; o->expr was already optimized */ + info->inline_fuel = -1; /* no more inlining; o->expr was already optimized */ info->no_types = 1; /* cannot used inferred types, in case `val' inferred them */ save_vclock = info->vclock; /* allowed to move => no change to clocks */ save_aclock = info->aclock;