diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/check-class-unit.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/check-class-unit.rkt index ad12da7e..138fbf6d 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/check-class-unit.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/check-class-unit.rkt @@ -444,14 +444,14 @@ (check-same optional-external exp-optional-inits "optional init argument")) (check-exists super-method-names this%-override-names - "override method") + "overridable method") (check-exists super-augment-names this%-augment-names - "augment method") + "augmentable method") (check-exists (set-union super-method-names super-augment-names) this%-inherit-names - "inherited method") + "method") (check-exists super-field-names this%-inherit-field-names - "inherited field") + "field") (check-absent super-field-names this%-field-names "public field") (check-absent super-method-names this%-public-names "public method") (check-absent super-augment-names this%-pubment-names @@ -1113,8 +1113,8 @@ (for/or ([m (in-set required)]) (and (not (set-member? actual m)) m))) (when missing - (tc-error/expr (~a "class definition missing ~a ~a " - "that is required by the expected type") + (tc-error/expr (~a "superclass missing ~a ~a " + "that the current class requires") msg missing))) ;; Set Set String -> Void diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/class-tests.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/class-tests.rkt index 7ddc59f1..655ff825 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/class-tests.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/class-tests.rkt @@ -348,7 +348,7 @@ (define/override (m y) (* 2 y))))) ;; fails, superclass missing public for override - (check-err #:exn #rx"missing override method m" + (check-err #:exn #rx"superclass missing overridable method m" (: d% (Class [m (Integer -> Integer)])) (define d% (class object% (super-new) (define/override (m y) (* 2 y))))) @@ -578,6 +578,12 @@ (inherit-field [y x]) (set! y 1))) + ;; fails, superclass missing inherited field + (check-err #:exn #rx"superclass missing field" + (class (class object% (super-new)) + (super-new) + (inherit-field [y x]))) + ;; fails, missing super method for inherit (check-err (class (class object% (super-new)) (super-new) (inherit z)))