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 5a8aec44..c42e912f 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 @@ -377,7 +377,13 @@ list (#%plain-app cons (quote init-id) arg:expr) ...)) - (for ([init-id (syntax->datum #'(init-id ...))] + (define provided-inits (syntax->datum #'(init-id ...))) + (for ([(name val) (in-dict super-inits)] + #:when (not (cadr val))) + (unless (member name provided-inits) + (tc-error/expr "mandatory superclass init ~a not provided" + name))) + (for ([init-id provided-inits] [init-arg (syntax->list #'(arg ...))]) (define maybe-expected (dict-ref super-inits init-id #f)) (if maybe-expected 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 58ff1cec..6b127e3b 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 @@ -338,6 +338,13 @@ (init x))) (new d%)) + ;; fails, mandatory super-class init not provided + (check-err + (class: (class: object% (super-new) + (: x Integer) + (init x)) + (super-new))) + ;; test different internal/external names (check-ok (define c% (class: object% (super-new)