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.
This commit is contained in:
Matthew Flatt 2019-04-24 07:56:07 -06:00
parent c838d01c09
commit 20e669f478

View File

@ -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)])