File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
typed-racket-lib/typed-racket/utils
typed-racket-test/succeed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 23
23
(and/c hash? hash-weak? (hash/c/check-key k v #:immutable #f )))
24
24
25
25
(define (hash/c/check-key k v #:immutable [immutable 'dont-care ])
26
- ;; TODO if (flat-contract? k), then make a contract that produces a "good"
27
- ;; error message given a hashtable that is not a `hash-equal?`
28
- (hash/c k v #:immutable immutable))
26
+ (if (flat-contract? k)
27
+ (hash/c k v #:immutable immutable)
28
+ (and/c (flat-named-contract
29
+ "hash-equal? (because the key contract is not a flat contract) "
30
+ hash-equal?)
31
+ (hash/c k v #:immutable immutable))))
Original file line number Diff line number Diff line change 11
11
12
12
(require 't rackunit)
13
13
14
- (define err-regexp #rx"expected equal\\?-based hash " )
14
+ (define err-regexp #rx"hash- equal\\?.*key contract is not a flat contract " )
15
15
16
16
(check-exn err-regexp
17
17
(λ () (give-me-a-hash (hasheqv))))
You can’t perform that action at this time.
0 commit comments