hash table keys are contravariant, not covariant

svn: r15077

original commit: e14e58c8df07a874c5a9093c9453de92f3ab04f2
This commit is contained in:
Sam Tobin-Hochstadt 2009-06-04 14:38:59 +00:00
parent b659f1b16a
commit 17a3d0944e
2 changed files with 5 additions and 2 deletions

View File

@ -724,6 +724,9 @@
(andmap null? (map list y)))
(-polydots (a) ((list -Number) (a a) . ->... . -Boolean))]
[tc-e (ann (error 'foo) (values Number Number)) #:ret (ret (list -Number -Number))]
[tc-e #{(make-hash) :: (HashTable Number Number)}
(make-Hashtable -Number -Number)]
#;[tc-err (let: ([fact : (Number -> Number) (lambda: ([n : Number]) (if (zero? n) 1 (* n (fact (- n 1)))))])
(fact 20))]

View File

@ -386,8 +386,8 @@
[((Box: e) (Box: e*))
(cset-meet (cg e e*) (cg e* e))]
[((Hashtable: s1 s2) (Hashtable: t1 t2))
;; the key is covariant, the value is invariant
(cset-meet* (list (cg s1 t1) (cg t2 s2) (cg s2 t2)))]
;; the key is contravariant, the value is invariant
(cset-meet* (list (cg t1 s1) (cg t2 s2) (cg s2 t2)))]
[((Syntax: s1) (Syntax: s2))
(cg s1 s2)]
;; parameters are just like one-arg functions