typed-racket icon indicating copy to clipboard operation
typed-racket copied to clipboard

The new hash match pattern doesn't work in Typed Racket

Open shawnw opened this issue 1 year ago • 0 comments

#lang typed/racket

(match '#hash((a . 2))
  [(hash 'a _) #t]
  [_ #f])

produces the following error on Racket 8.12:

 Type Checker: missing type for identifier;
 consider using `require/typed' to import it
  identifier: hash-state
  from module: runtime.rkt in: (match (quote #hash((a . 2))) ((hash (quote a) _) #t) (_ #f))

and

(match '#hash((a . 2))
  [(hash 'a _ #:open) #t]
  [_ #f])

gives

 Type Checker: missing type for identifier;
 consider using `require/typed' to import it
  identifier: undef
  from module: runtime.rkt in: (match (quote #hash((a . 2))) ((hash (quote a) _ #:open) #t) (_ #f))
. Type Checker: missing type for identifier;
 consider using `require/typed' to import it
  identifier: undef?
  from module: runtime.rkt in: (match (quote #hash((a . 2))) ((hash (quote a) _ #:open) #t) (_ #f))
. Type Checker: Summary: 2 errors encountered in:
  (match (quote #hash((a . 2))) ((hash (quote a) _ #:open) #t) (_ #f))
  (match (quote #hash((a . 2))) ((hash (quote a) _ #:open) #t) (_ #f))

shawnw avatar Feb 20 '24 18:02 shawnw