diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-lambda-unit.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-lambda-unit.rkt index bc920ac5..98947897 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-lambda-unit.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-lambda-unit.rkt @@ -317,7 +317,7 @@ [(Function: (and fs (list (arr: argss rets rests drests '()) ...))) (for/list ([a (in-list argss)] [f (in-list fs)] [r (in-list rests)] [dr (in-list drests)] #:when (if (formals-rest fml) - (>= (length a) (length (formals-positional fml))) + (or r (>= (length a) (length (formals-positional fml)))) ((if (or r dr) <= =) (length a) (length (formals-positional fml))))) f)] [_ null])) diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/fail/case-lambda1.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/fail/case-lambda1.rkt index 6d98ac76..93dce922 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/fail/case-lambda1.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/fail/case-lambda1.rkt @@ -1,5 +1,5 @@ #; -(exn-pred 1) +(exn-pred 2) #lang typed/racket (: f (case-> (Symbol Symbol * -> Integer) diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt index 9e7427b5..9ba96ef4 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/typecheck-tests.rkt @@ -2747,6 +2747,18 @@ (f 1 2 3)) #:ret (ret Univ -true-filter)] + [tc-err + (case-lambda + ((x y . z) 'x) + ((x . y) 'x) + (w (first w))) + #:ret + (ret (cl->* (->* (list -Symbol -Symbol) -Symbol -Symbol) + (->* (list) -String -String))) + #:expected + (ret (cl->* (->* (list -Symbol -Symbol) -Symbol -Symbol) + (->* (list) -String -String)))] + ;; typecheck-fail should fail [tc-err (typecheck-fail #'stx "typecheck-fail") #:msg #rx"typecheck-fail"]