add ids from in-hash- expansion to special-env

- fixes test failures due to 048c4b4a73
- add in-hash- tests
This commit is contained in:
Stephen Chang 2016-02-05 18:26:03 -05:00
parent 89a58bf670
commit c19fac7fd5
3 changed files with 36 additions and 0 deletions

View File

@ -132,6 +132,22 @@
(-poly (a b)
(cl-> [((-HT a b)) (-seq (-pair a b))]
[(-HashTop) (-seq (-pair Univ Univ))]))]
[(make-template-identifier 'default-in-hash-key+values 'racket/private/for)
(-poly (a b)
(cl-> [((-HT a b)) (-seq a b)]
[(-HashTop) (-seq Univ Univ)]))]
[(make-template-identifier 'default-in-hash-keys 'racket/private/for)
(-poly (a b)
(cl-> [((-HT a b)) (-seq a)]
[(-HashTop) (-seq Univ)]))]
[(make-template-identifier 'default-in-hash-values 'racket/private/for)
(-poly (a b)
(cl-> [((-HT a b)) (-seq b)]
[(-HashTop) (-seq Univ)]))]
[(make-template-identifier 'default-in-hash-pairs 'racket/private/for)
(-poly (a b)
(cl-> [((-HT a b)) (-seq (-pair a b))]
[(-HashTop) (-seq (-pair Univ Univ))]))]
;; in-port
[(make-template-identifier 'in-port 'racket/private/for)
(->opt [(-> -Input-Port Univ) -Input-Port] (-seq Univ))]

View File

@ -59,6 +59,7 @@
[tc-e (in-hash #hash((1 . 2))) (-seq -Integer -Integer)]
[tc-e (in-hash-keys #hash((1 . 2))) (-seq -Integer)]
[tc-e (in-hash-values #hash((1 . 2))) (-seq -Integer)]
[tc-e (in-hash-pairs #hash((1 . 2))) (-seq (-pair -Integer -Integer))]
(tc-e (file->string "tmp") -String)
(tc-e (file->string "tmp" #:mode 'binary) -String)

View File

@ -2535,6 +2535,19 @@
(values v k)))
h)
(-HT Univ Univ)]
[tc-e/t (let ()
(tr:define h : (HashTable Any Any)
(for/hash ([k (in-hash-keys #hash(("a" . a)))]
[v (in-hash-values #hash(("a" . a)))])
(values v k)))
h)
(-HT Univ Univ)]
[tc-e/t (let ()
(tr:define h : (HashTable Any Any)
(for/hash ([k+v (in-hash-pairs #hash(("a" . a)))])
(values (cdr k+v) (car k+v))))
h)
(-HT Univ Univ)]
;; call-with-input-string and friends - PR 14050
[tc-e (call-with-input-string "abcd" (lambda: ([input : Input-Port]) (values 'a 'b)))
@ -3838,6 +3851,12 @@
[tc-e (ann (in-hash (hash)) (Sequenceof Any Any))
(-seq Univ Univ)]
[tc-e (ann (in-hash-keys (hash)) (Sequenceof Any))
(-seq Univ)]
[tc-e (ann (in-hash-values (hash)) (Sequenceof Any))
(-seq Univ)]
[tc-e (ann (in-hash-pairs (hash)) (Sequenceof (Pairof Any Any)))
(-seq (-pair Univ Univ))]
)
(test-suite