Fix broken case in case-lambda.

This commit is contained in:
Eric Dobson 2014-04-21 22:47:47 -07:00
parent fdbe0d3f27
commit 2613994ca7
3 changed files with 14 additions and 2 deletions

View File

@ -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]))

View File

@ -1,5 +1,5 @@
#;
(exn-pred 1)
(exn-pred 2)
#lang typed/racket
(: f (case->
(Symbol Symbol * -> Integer)

View File

@ -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"]