From a0b7123d4c1a1b4ff67c90f0af1537853ade3395 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Tue, 28 Jul 2015 14:43:08 -0700 Subject: [PATCH] Handle `for-meta` in TR requires. --- .../typed-racket/typecheck/tc-toplevel.rkt | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt b/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt index a49abc51..3421fa41 100644 --- a/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt +++ b/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt @@ -376,16 +376,22 @@ (syntax-parse p #:literal-sets (kernel-literals) [(#%provide form ...) (for/fold ([h h]) ([f (in-syntax #'(form ...))]) - (syntax-parse f - [i:id - (dict-update h #'i (lambda (tail) (cons #'i tail)) '())] - [((~datum rename) in out) - (dict-update h #'in (lambda (tail) (cons #'out tail)) '())] - [(name:unknown-provide-form . _) - (parameterize ([current-orig-stx f]) - (tc-error "provide: ~a not supported by Typed Racket" (syntax-e #'name.name)))] - [_ (parameterize ([current-orig-stx f]) - (int-err "unknown provide form"))]))] + (let loop ([f f]) + (syntax-parse f + [i:id + (dict-update h #'i (lambda (tail) (cons #'i tail)) '())] + [((~datum rename) in out) + (dict-update h #'in (lambda (tail) (cons #'out tail)) '())] + [((~datum for-meta) 0 fm) + (loop #'fm)] + ;; is this safe? + [((~datum for-meta) _ fm) + h] + [(name:unknown-provide-form . _) + (parameterize ([current-orig-stx f]) + (tc-error "provide: ~a not supported by Typed Racket" (syntax-e #'name.name)))] + [_ (parameterize ([current-orig-stx f]) + (int-err "unknown provide form"))])))] [_ (int-err "non-provide form! ~a" (syntax->datum p))]))) ;; compute the new provides (define-values (new-stx/pre new-stx/post)