Fix type of andmap and ormap on empty lists.

Closes PR 12882.
This commit is contained in:
Vincent St-Amour 2012-07-06 12:05:57 -04:00
parent 0a5e92c299
commit dba49db078
2 changed files with 4 additions and 2 deletions

View File

@ -230,6 +230,8 @@
[tc-e (values) #:ret (ret null)]
[tc-e (values 3 #f) #:ret (ret (list -PosByte (-val #f)) (list (-FS -top -bot) (-FS -bot -top)))]
[tc-e (map #{values @ Symbol} '(a b c)) (-pair Sym (make-Listof Sym))]
[tc-e (andmap add1 (ann '() (Listof Number))) (t:Un (-val #t) N)]
[tc-e (ormap add1 (ann '() (Listof Number))) (t:Un (-val #f) N)]
[tc-e (letrec: ([fact : (Number -> Number) (lambda: ([n : Number]) (if (zero? n) 1 (* n (fact (- n 1)))))])
(fact 20))
N]

View File

@ -252,11 +252,11 @@
[defined? (->* (list Univ) -Boolean : (-FS (-not-filter -Undefined 0 null) (-filter -Undefined 0 null)))]
[ormap (-polydots (a c b) (->... (list (->... (list a) (b b) c) (-lst a)) ((-lst b) b) c))]
[ormap (-polydots (a c b) (->... (list (->... (list a) (b b) c) (-lst a)) ((-lst b) b) (Un c (-val #f))))]
[andmap (-polydots (a c d b) (cl->*
;; 1 means predicate on second argument
(make-pred-ty (list (make-pred-ty (list a) c d) (-lst a)) c (-lst d) 1)
(->... (list (->... (list a) (b b) c) (-lst a)) ((-lst b) b) c)))]
(->... (list (->... (list a) (b b) c) (-lst a)) ((-lst b) b) (Un c (-val #t)))))]
[box (-poly (a) (a . -> . (-box a)))]
[box-immutable (-poly (a) (a . -> . (-box a)))]