[racket] typed racket and unions of vector types
I ran into this when trying to do vector-ref on a value of type In-Indexes from math/array.
If I do something like this:
#lang typed/racket
(: v : (U (Vectorof Index)
(Vectorof Integer)))
(define v #(0))
(ann (vector-ref v 0) Integer)
Then it doesn't type check. I understand that (Vectorof Index) isn’t a subtype of (Vectorof Integer), but still, why doesn’t this work?
Is there any reason why the type checker doesn’t do something where it checks both components of a union type and if both work then the union type works?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140720/ecbbef76/attachment.html>