From e54e67fc29569d15877871c85ebc2b9aa2e7a0c9 Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Sat, 25 May 2013 13:32:57 -0700 Subject: [PATCH] Make tc-app-object use a real dictionary. --- .../typecheck/tc-app/tc-app-objects.rkt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/collects/typed-racket/typecheck/tc-app/tc-app-objects.rkt b/collects/typed-racket/typecheck/tc-app/tc-app-objects.rkt index b0b1a072a5..37640c63bb 100644 --- a/collects/typed-racket/typecheck/tc-app/tc-app-objects.rkt +++ b/collects/typed-racket/typecheck/tc-app/tc-app-objects.rkt @@ -4,7 +4,7 @@ "signatures.rkt" "utils.rkt" syntax/parse syntax/stx racket/match unstable/sequence unstable/syntax - syntax/parse/experimental/reflect + syntax/parse/experimental/reflect racket/dict (typecheck signatures tc-funapp) (types abbrev union utils) (rep type-rep) @@ -32,7 +32,7 @@ ;; (it's just an s-expression) (define (check-do-make-object b cl pos-args names named-args) (let* ([names (stx-map syntax-e names)] - [name-assoc (stx-map list names named-args)]) + [name-assoc (stx-map cons names named-args)]) (let loop ([t (tc-expr cl)]) (match t [(tc-result1: (? Mu? t*)) (loop (ret (unfold t*)))] @@ -53,12 +53,12 @@ n (stringify tnames))) (for-each (match-lambda [(list tname tfty opt?) - (let ([s (cond [(assq tname name-assoc) => cadr] - [(not opt?) - (tc-error/delayed "value not provided for named init arg ~a" - tname) - #f] - [else #f])]) + (let ([s (dict-ref name-assoc tname + (lambda () + (unless opt? + (tc-error/delayed "value not provided for named init arg ~a" + tname)) + #f))]) (if s ;; this argument was present (tc-expr/check s (ret tfty))