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 dbf5c446de..3a900ee336 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 @@ -398,7 +398,11 @@ (tc-error/expr "typed classes must call super-new at the class top-level") null] - [else + [(> (length super-new-stx) 1) + (tc-error/expr + "typed classes must only call super-new a single time") + null] + [(= (length super-new-stx) 1) (syntax-parse (car super-new-stx) #:literals (#%plain-app list cons quote) [(#%plain-app super-go _ _ _ _ _ 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 14cea8b43b..7c0c21db20 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 @@ -385,6 +385,12 @@ (super-new [x 3]))) (new c% [x 5])) + ;; fails, super-new can only be called once per class + (check-err + (class: object% + (super-new) + (super-new))) + ;; test different internal/external names (check-ok (define c% (class: object% (super-new)