From 20e669f47842d47b085ddedc5782e4a95495653a Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 24 Apr 2019 07:56:07 -0600 Subject: [PATCH] adjust `local-require` to help Check Syntax Currently, Check Syntax has trouble correlating `require` forms and references to imports that go through a macro-introduced rename transformer. For example, there's no binding arrow from the final `starting` to the `racket/list` in #lang racket/base (require (for-syntax racket/base)) (define-syntax-rule (define-as-first mod starting) (begin (require (only-in mod [first initial])) (define-syntax starting (make-rename-transformer #'initial)) starting)) (define-as-first racket/list starting) starting But change the last two `starting`s to `initial`, and the binding arrows work. Until a general repair is in place for Check Syntax, this commit adjusts 38d612dba6 to use the original export name for an immediate binding, which acts as a hint to the current Check Syntax implemenration. --- racket/collects/racket/private/reqprov.rkt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/racket/collects/racket/private/reqprov.rkt b/racket/collects/racket/private/reqprov.rkt index f62fc13605..e4ab34aec1 100644 --- a/racket/collects/racket/private/reqprov.rkt +++ b/racket/collects/racket/private/reqprov.rkt @@ -1202,7 +1202,13 @@ (list* #'only-meta-in 0 (syntax->list #'(spec ...))) stx))] [(names) (map import-local-id imports)] - [(reqd-names) (generate-temporaries names)] + [(reqd-names) + ;; Could be just `(generate-temporaries names)`, but using the + ;; exported name turns out to be a hint to Check Syntax for binding + ;; arrows, for now: + (let ([intro (make-syntax-introducer)]) + (map (lambda (n) (intro (datum->syntax #f (syntax-e n) n))) + names))] [(renamed-imports) (map rename-import imports reqd-names)] [(raw-specs) (map import->raw-require-spec renamed-imports)] [(lifts) (map syntax-local-lift-require raw-specs reqd-names)])