re-finangle `define/intermediate` to allow require & provides

Needed to change from `make-rename-transformer` to
`make-variable-like-transformer` because apparently rename transformers
are treated differently when referred to from another model, hiding the
syntax properties on the target.
This commit is contained in:
Sam Caldwell 2018-09-14 16:40:43 -04:00
parent dcc6bbcbe7
commit 70aafc8bdf
3 changed files with 20 additions and 3 deletions

View File

@ -0,0 +1,8 @@
#lang typed/syndicate/roles
(provide a-fun)
(define (a-fun [x : Int] -> Int)
(+ x 1))
#;(a-fun 5)

View File

@ -0,0 +1,5 @@
#lang typed/syndicate/roles
(require "provides.rkt")
(a-fun 5)

View File

@ -37,6 +37,8 @@
print-type print-role
;; Extensions
match cond
;; require & provides
require provide
)
(require (prefix-in syndicate: syndicate/actor-lang))
@ -1411,10 +1413,12 @@
(define-syntax (define/intermediate stx)
(syntax-parse stx
[(_ x:id x-:id τ e)
;; typed-variable-rename allows for using at module top level
#:with x+ (add-orig (assign-type #'x- #'τ #:wrap? #f) #'x)
;; including a syntax binding for x allows for module-top-level references
;; (where walk/bind won't replace further uses) and subsequent provides
#'(begin-
(define-typed-variable-rename x x- : τ)
(define- x- e))]))
(define-syntax x (make-variable-like-transformer #'x+))
(define- x+ e))]))
;; copied from ext-stlc
(define-typed-syntax define