Don't lose syntax locations for TR define

Closes PR 14544

original commit: ca8d8346b6d6f99338f1b325cf8f1b412ccefd87
This commit is contained in:
Asumu Takikawa 2014-06-05 11:21:39 -04:00
parent 1fa2b759e3
commit dfa444cf5b
2 changed files with 10 additions and 4 deletions

View File

@ -1222,11 +1222,11 @@ This file defines two sorts of primitives. All of them are provided into any mod
(-define nm : arrty
(-lambda formals body ...))))]
[(define: nm:id ~! (~describe ":" :) (~describe "type" ty) body)
#'(-define nm : ty body)]
(syntax/loc stx (-define nm : ty body))]
[(define: tvars:type-variables nm:id : ty body)
#'(-define #:forall tvars nm : ty body)]
(syntax/loc stx (-define #:forall tvars nm : ty body))]
[(define: tvars:type-variables (nm:id . formals:annotated-formals) : ret-ty body ...)
#'(-define #:forall tvars (nm . formals) : ret-ty body ...)]))
(syntax/loc stx (-define #:forall tvars (nm . formals) : ret-ty body ...))]))
(define-syntax (-define stx)
(syntax-parse stx #:literals (:)
@ -1266,7 +1266,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
[(-lambda formals . others)
(template (-lambda (?@ . vars) formals . others))]
[_ rhs]))
#`(define #,defined-id #,rhs*)]))
(quasisyntax/loc stx (define #,defined-id #,rhs*))]))
(define-syntax (with-asserts stx)
(define-syntax-class with-asserts-clause

View File

@ -0,0 +1,6 @@
#;
(exn-pred (regexp-quote "in: (define (f x y z) (+ y z))"))
#lang typed/racket
(: f (-> Number Number Number))
(define (f x y z) (+ y z))