diff --git a/pkgs/racket-test-core/tests/racket/module.rktl b/pkgs/racket-test-core/tests/racket/module.rktl index 20748c9e9b..2701e7812d 100644 --- a/pkgs/racket-test-core/tests/racket/module.rktl +++ b/pkgs/racket-test-core/tests/racket/module.rktl @@ -2654,6 +2654,22 @@ case of module-leve bindings; it doesn't cover local bindings. (test 'ok dynamic-require ''discards-module-begin-macro-definition 'result) +;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Make sure a compile-time `eval` (as opposed to `eval-syntax`) +;; doesn't add the wrong phase's bindings via +;; `namespace-syntax-introduce`. The wrong phase's bindings in this +;; example could make `#%app` ambiguous. + +(module uses-eval-at-compile-time racket/base + (require (for-syntax racket/base) + (for-meta 2 racket/base)) + + (define-syntax (ct-eval stx) + (syntax-case stx () + [(_ e) #`'#,(eval #'e)])) + + (ct-eval (+ 1 2))) + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (report-errs) diff --git a/racket/src/expander/namespace/api.rkt b/racket/src/expander/namespace/api.rkt index 483e143c1f..b29144c2a9 100644 --- a/racket/src/expander/namespace/api.rkt +++ b/racket/src/expander/namespace/api.rkt @@ -62,7 +62,7 @@ (define other-namespace-scopes (for/list ([sc (in-set ;; `all-scopes-stx` corresponds to the initial import (syntax-scope-set (root-expand-context-all-scopes-stx root-ctx) - (namespace-phase ns)))] + 0))] #:unless (equal? sc post-scope)) sc)) (define (add-ns-scopes s) diff --git a/racket/src/racket/src/startup.inc b/racket/src/racket/src/startup.inc index e8f4b614d6..3c0c671a75 100644 --- a/racket/src/racket/src/startup.inc +++ b/racket/src/racket/src/startup.inc @@ -44047,7 +44047,7 @@ static const char *startup_source = "(let-values(((ht_148)" "(syntax-scope-set" "(root-expand-context-all-scopes-stx root-ctx_5)" -"(namespace-phase ns_58))))" +" 0)))" "(begin" "(if(variable-reference-from-unsafe?(#%variable-reference))" "(void)"