add generalize clauses for new hash types

This commit is contained in:
Andrew Kent 2017-07-01 22:44:48 +01:00 committed by GitHub
parent f2bf1062bc
commit 000af1f28c
2 changed files with 48 additions and 0 deletions

View File

@ -31,6 +31,9 @@
[(? (lambda (t) (subtype t -Char))) -Char]
[(? (lambda (t) (subtype t -ExtFlonum))) -ExtFlonum]
[(Listof: _) t*]
[(Immutable-HashTable: k v) (-HT k v)]
[(Mutable-HashTable: k v) (-HT k v)]
[(Weak-HashTable: k v) (-HT k v)]
[(Pair: t1 (== -Null)) (-lst t1)]
[(MPair: t1 (== -Null)) (-mlst t1)]
[(or (Pair: t1 t2) (MPair: t1 t2))

View File

@ -3970,6 +3970,51 @@
[tc-e (let ([a (inst cons Integer Integer)])
(cons #f #f))
(-pair -False -False)]
;; TR github issue 573
;; make sure immutable hash tables generalize to just hash
[tc-e (let ()
(define h1 (hash))
(: hfun (-> (HashTable Any Any) (HashTable Any Any)))
(define (hfun h) h)
(define h2
(for/fold : (HashTable Any Any)
([h h1])
([_ (in-range 3)])
(hfun h)))
(void))
-Void]
;; TR github issue 573
;; make sure mutable hash tables generalize to just hash
[tc-e (let ()
(define h1 (make-hash '()))
(: hfun (-> (HashTable Any Any) (HashTable Any Any)))
(define (hfun h) h)
(define h2
(for/fold : (HashTable Any Any)
([h h1])
([_ (in-range 3)])
(hfun h)))
(void))
-Void]
;; TR github issue 573
;; make sure weak hash tables generalize to just hash
[tc-e (let ()
(define h1 (make-weak-hash '()))
(: hfun (-> (HashTable Any Any) (HashTable Any Any)))
(define (hfun h) h)
(define h2
(for/fold : (HashTable Any Any)
([h h1])
([_ (in-range 3)])
(hfun h)))
(void))
-Void]
)
(test-suite