From b214fa01c11c6fc74f24318bc702bbb5ad915822 Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Wed, 16 Oct 2013 14:36:06 -0400 Subject: [PATCH] Use string->uninterned-symbol instead of gensym The reason these functions used gensym to begin with was that fresh variables resulted in confusing error messages of the form "Expected a, but got a". An upcoming commit fixes these error messages, so the gensym is replaced. --- .../typed-racket-lib/typed-racket/rep/type-rep.rkt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/rep/type-rep.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/rep/type-rep.rkt index f2de3f5d5c..1322902a23 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/rep/type-rep.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/rep/type-rep.rkt @@ -750,6 +750,11 @@ (list syms (Poly-body* syms t)))) (list nps bp)))]))) +;; Helper for fresh match expanders below, creates a +;; fresh name that prints the same as the original +(define (fresh-name sym) + (string->uninterned-symbol (symbol->string sym))) + ;; This match expander creates new fresh names for exploring the body ;; of the polymorphic type. When lexical scoping of type variables is a concern, you ;; should use this form. @@ -761,7 +766,7 @@ (app (lambda (t) (let* ([n (Poly-n t)] [syms (hash-ref name-table t (lambda _ (build-list n (lambda _ (gensym)))))] - [fresh-syms (map gensym syms)]) + [fresh-syms (map fresh-name syms)]) (list syms fresh-syms (Poly-body* fresh-syms t)))) (list nps freshp bp)))])))