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 278cc255a9..c6480f824f 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 @@ -1421,7 +1421,7 @@ core-body ...))) method-body ...)]) m) - kw:kw-lambda^) + (~or kw:kw-lambda^ opt:opt-lambda^)) (do-register #'self-param #'meth-name)] ;; case-lambda methods [(let-values ([(meth-name:id) 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 2f43ca82c2..3cdceaff89 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 @@ -1493,4 +1493,16 @@ [tc-err (make-object (ann object% ClassTop)) #:msg #rx"cannot instantiate.*ClassTop"] [tc-err (make-object 3) - #:msg #rx"value of a non-class type"])) + #:msg #rx"value of a non-class type"] + ;; PR 14726 + ;; test opt-arg but non-keyword method + [tc-e (let () + (define-type-alias A% + (Class [foo (->* [Integer] Void)])) + (: a% A%) + (define a% + (class object% + (super-new) + (define/public (foo [i #f]) (void)))) + (new a%)) + (-object #:method ([foo (t:-> -Integer -Void)]))]))