From 51f9008b9910872afb3be92c3e4914771bf54661 Mon Sep 17 00:00:00 2001 From: Stephen Chang Date: Tue, 19 Apr 2016 16:06:09 -0400 Subject: [PATCH] fix bug in `reuse` to avoid conflict with ids that happen to use the same prefix --- tapl/typecheck.rkt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tapl/typecheck.rkt b/tapl/typecheck.rkt index 2bf2f9a..5bde656 100644 --- a/tapl/typecheck.rkt +++ b/tapl/typecheck.rkt @@ -123,13 +123,16 @@ (let* ([pre-str #,(string-append (drop-file-ext (syntax-e #'base-lang)) ":")] [pre-str-len (string-length pre-str)] [drop-pre (λ (s) (substring s pre-str-len))] - [excluded (map (compose symbol->string syntax->datum) (syntax->list #'(new ...)))]) + [excluded (map (compose symbol->string syntax->datum) (syntax->list #'(new ...)))] + [origs (map symbol->string (syntax->datum #'(x ...)))]) (λ (name) (define out-name (or (and (string-prefix? name pre-str) (drop-pre name)) name)) - (and (not (member out-name excluded)) out-name))) + (and (not (member out-name excluded)) + (member out-name origs) + out-name))) (all-from-out base-lang))))])) (define-syntax add-expected