Add type for in-hash-pairs

Related to PR 13937
This commit is contained in:
Asumu Takikawa 2013-08-01 00:16:57 -04:00
parent e5e6d097be
commit 992a14ccb5
2 changed files with 18 additions and 0 deletions

View File

@ -116,6 +116,10 @@
(-poly (a b)
(cl-> [((-HT a b)) (-seq b)]
[(-HashTop) (-seq Univ)]))]
[(make-template-identifier '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

@ -0,0 +1,14 @@
#lang typed/racket
;; Test for PR 13937
;; This does not directly test the issue in PR 13937, but
;; tests a workaround using `in-hash-pairs`.
;;
;; This should be a unit test, but the typecheck tests do
;; not play nice with base-special-env bindings like `in-hash-pairs`
;;
(for/hash: : (HashTable Symbol Integer)
([p : (Pairof Symbol Integer) (in-hash-pairs #hash((a . 5)))])
(values (car p) (cdr p)))