typed-racket
typed-racket copied to clipboard
match macro: list-no-order loses type information on bound variables
What version of Racket are you using?
v6.12
What program did you run?
#lang typed/racket
(: id (-> Integer Integer))
(define (id x) x)
(match '(5)
((list-no-order (? integer? x)) (id x)))
What should have happened?
The program should output 5.
If list-no-order
is changed to list
, the program typechecks successfully.
If you got an error message, please include it here.
a.rkt:7:38: Type Checker: type mismatch
expected: Integer
given: Any
in: x
Normally, changing x
to #{x : Integer}
works around issues with the match
macro, but this is not available here:
a.rkt:6:0: Type Checker: Polymorphic function `car' could not be applied to arguments:
Types: (Pairof a b) -> (a : ((! (car (0 0)) False) | (: (car (0 0)) False)) : (car (0 0)))
(Listof a) -> a
Arguments: (Listof Any)
Expected result: Integer