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 83df203f49..c0bfa7a1b4 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 @@ -794,6 +794,20 @@ (#%plain-lambda (#,annotated-self-param id ...) body ...)]) m)] + [(let-values ([(meth-name:id) + (let-values (((core:id) + (#%plain-lambda (param:id ...) + core-body ...))) + method-body ...)]) + m) + #`(let-values ([(#,(syntax-property #'meth-name 'type-label method-type)) + #,(syntax-property + #'(let-values (((core) + (#%plain-lambda (param ...) + core-body ...))) + method-body ...) + 'kw-lambda #t)]) + m)] [_ (tc-error "annotate-method: internal error")])) ;; 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 0038b21258..9014761d14 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 @@ -516,6 +516,16 @@ (inherit m) (m "foo"))) + ;; test that keyword methods type-check + ;; FIXME: send with keywords does not work yet + (check-ok + (: c% (Class [n (Integer #:foo Integer -> Integer)])) + (define c% + (class: object% + (super-new) + (define/public (n x #:foo foo) + (+ foo x))))) + ;; test different internal/external names (check-ok (define c% (class: object% (super-new)