Instead of attaching syntax properties during expansion, generate code
that does so This resolves the "namespace mismatch: cannot locate module instance" error.
This commit is contained in:
parent
3a06e2324c
commit
c7cc84302e
|
@ -367,11 +367,12 @@
|
||||||
#:datum-literals (:)
|
#:datum-literals (:)
|
||||||
[(_ lib [name:id : ty:type] ...)
|
[(_ lib [name:id : ty:type] ...)
|
||||||
#:with (name- ...) (format-ids "~a-" #'(name ...))
|
#:with (name- ...) (format-ids "~a-" #'(name ...))
|
||||||
#:with (name+ ...) (assign-types #'((name- ty name) ...))
|
|
||||||
(syntax/loc stx
|
(syntax/loc stx
|
||||||
(begin-
|
(begin-
|
||||||
(require (only-in lib [name name+] ...))
|
(require (only-in lib [name name-] ...))
|
||||||
(define-syntax name (make-variable-like-transformer #'name+)) ...))]))
|
(define-syntax name
|
||||||
|
(make-variable-like-transformer (add-orig (assign-type #'name- #'ty #:wrap? #f) #'name)))
|
||||||
|
...))]))
|
||||||
|
|
||||||
;; Format identifiers in the same way
|
;; Format identifiers in the same way
|
||||||
;; FormatString (SyntaxListOf Identifier) -> (Listof Identifier)
|
;; FormatString (SyntaxListOf Identifier) -> (Listof Identifier)
|
||||||
|
@ -1511,12 +1512,12 @@
|
||||||
(define-syntax (define/intermediate stx)
|
(define-syntax (define/intermediate stx)
|
||||||
(syntax-parse stx
|
(syntax-parse stx
|
||||||
[(_ x:id x-:id τ e)
|
[(_ x:id x-:id τ e)
|
||||||
#:with x+ (add-orig (assign-type #'x- #'τ #:wrap? #f) #'x)
|
|
||||||
;; including a syntax binding for x allows for module-top-level references
|
;; including a syntax binding for x allows for module-top-level references
|
||||||
;; (where walk/bind won't replace further uses) and subsequent provides
|
;; (where walk/bind won't replace further uses) and subsequent provides
|
||||||
#'(begin-
|
#'(begin-
|
||||||
(define-syntax x (make-variable-like-transformer #'x+))
|
(define-syntax x
|
||||||
(define- x+ e))]))
|
(make-variable-like-transformer (add-orig (assign-type #'x- #'τ #:wrap? #f) #'x)))
|
||||||
|
(define- x- e))]))
|
||||||
|
|
||||||
;; copied from ext-stlc
|
;; copied from ext-stlc
|
||||||
(define-typed-syntax define
|
(define-typed-syntax define
|
||||||
|
|
Loading…
Reference in New Issue