From 52c74701ecef53e6e2644ba2e178bb74be01b317 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Fri, 13 Dec 2013 12:02:53 -0600 Subject: [PATCH] improve the first-order checking for the current class/c implementation (not strictly necessary, but the new, still pending class/c first-order checking checks the arities of the methods and those additional tests got put into the test suite, so the easiest thing for now is just to make the current class/c implementation do that check too) --- racket/collects/racket/private/class-internal.rkt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/racket/collects/racket/private/class-internal.rkt b/racket/collects/racket/private/class-internal.rkt index 587f73dfcc..8b007e4eb4 100644 --- a/racket/collects/racket/private/class-internal.rkt +++ b/racket/collects/racket/private/class-internal.rkt @@ -2810,11 +2810,17 @@ An example (unless (-class? cls) ;; TODO: might be a wrapper class (fail '(expected: "a class" given: "~v") cls)) (let ([method-ht (class-method-ht cls)] + [methods (class-methods cls)] [beta-methods (class-beta-methods cls)] [meth-flags (class-meth-flags cls)]) - (for ([m (class/c-methods ctc)]) - (unless (hash-ref method-ht m #f) - (fail "no public method ~a" m))) + (for ([m (in-list (class/c-methods ctc))] + [c (in-list (class/c-method-contracts ctc))]) + (define mth (hash-ref method-ht m #f)) + (unless mth (fail "no public method ~a" m)) + (unless (contract-first-order-passes? + c + (vector-ref methods mth)) + (fail "public method ~a doesn't match contract" m))) (unless (class/c-opaque? ctc) (for ([m (class/c-absents ctc)]) (when (hash-ref method-ht m #f)