diff --git a/collects/scribblings/reference/class.scrbl b/collects/scribblings/reference/class.scrbl index 36f85ee5dc..42a494c3a0 100644 --- a/collects/scribblings/reference/class.scrbl +++ b/collects/scribblings/reference/class.scrbl @@ -1503,10 +1503,11 @@ Produces a contract for a class. There are two major categories of contracts listed in a @scheme[class/c] form: external and internal contracts. External contracts govern behavior -when methods or fields are accessed via an object of that class. Internal -contracts govern behavior when method or fields are accessed within the -class hierarchy. This separation allows for stronger contracts for class -clients and weaker contracts for subclasses. +when an object is instantiated from a class or when methods or fields are +accessed via an object of that class. Internal contracts govern behavior +when method or fields are accessed within the class hierarchy. This +separation allows for stronger contracts for class clients and weaker +contracts for subclasses. Method contracts must contain an additional initial argument which corresponds to the implicit @scheme[this] parameter of the method. This allows for diff --git a/collects/typed-scheme/private/type-contract.ss b/collects/typed-scheme/private/type-contract.ss index 081fbd5fec..f7566cb4f3 100644 --- a/collects/typed-scheme/private/type-contract.ss +++ b/collects/typed-scheme/private/type-contract.ss @@ -151,13 +151,15 @@ [(names ...) name]) #'(object/c (names fcn-cnts) ...))] ;; init args not currently handled by class/c - [(Class: _ _ (list (list name fcn) ...)) + [(Class: _ (list (list by-name-init by-name-init-ty _) ...) (list (list name fcn) ...)) (when flat? (exit (fail))) - (with-syntax ([(fcn-cnts ...) (for/list ([f fcn]) (t->c/fun f #:method #t))] - [(names ...) name]) + (with-syntax ([(fcn-cnt ...) (for/list ([f fcn]) (t->c/fun f #:method #t))] + [(name ...) name] + [(by-name-cnt ...) (for/list ([t by-name-init-ty]) (t->c/neg t))] + [(by-name-init ...) by-name-init]) #'class? #; - #'(class/c (names fcn-cnts) ...))] + #'(class/c (name fcn-cnt) ... (init [by-name-init by-name-cnt] ...)))] [(Value: '()) #'null?] [(Struct: nm par flds proc poly? pred? cert acc-ids) (cond