From a943d853757008891b23748f8aab04e4cd35c9bf Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Fri, 2 Jan 2015 20:57:08 -0500 Subject: [PATCH] Preserve more source locations for function definitions. --- typed-racket-lib/typed-racket/base-env/prims.rkt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/typed-racket-lib/typed-racket/base-env/prims.rkt b/typed-racket-lib/typed-racket/base-env/prims.rkt index 4f80eb72..6611df23 100644 --- a/typed-racket-lib/typed-racket/base-env/prims.rkt +++ b/typed-racket-lib/typed-racket/base-env/prims.rkt @@ -1168,9 +1168,9 @@ This file defines two sorts of primitives. All of them are provided into any mod (syntax-parse stx #:literals (:) [(define: (nm:id . formals:annotated-formals) (~describe "return type annotation" (~seq : ret-ty)) body ...) (with-syntax ([arrty (syntax/loc stx (formals.arg-ty ... -> ret-ty))]) - (syntax/loc stx + (quasisyntax/loc stx (-define nm : arrty - (-lambda formals body ...))))] + #,(syntax/loc stx (-lambda formals body ...)))))] [(define: nm:id ~! (~describe ":" :) (~describe "type" ty) body) (syntax/loc stx (-define nm : ty body))] [(define: tvars:type-variables nm:id : ty body) @@ -1197,9 +1197,9 @@ This file defines two sorts of primitives. All of them are provided into any mod (define nm body)))] [(-define (nm:id . formals:annotated-formals) : ret-ty body ...) (with-syntax ([arrty (syntax/loc stx (formals.arg-ty ... -> ret-ty))]) - (syntax/loc stx + (quasisyntax/loc stx (-define nm : arrty - (-lambda formals body ...))))] + #,(syntax/loc stx (-lambda formals body ...)))))] ;; bug 14702: the below should generate a `:` annotation when possible ;; currently, the above special case does the right thing for non-curried lambdas [(-define vars:maybe-lambda-type-vars @@ -1221,7 +1221,7 @@ This file defines two sorts of primitives. All of them are provided into any mod (syntax-parse rhs #:literals (-lambda) [(-lambda formals . others) - (template (-lambda (?@ . vars) formals . others))] + (template/loc stx (-lambda (?@ . vars) formals . others))] [_ rhs])) (quasisyntax/loc stx (define #,defined-id #,rhs*))]))