<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I ran into this when trying to do vector-ref on a value of type In-Indexes from math/array.<div><br></div><div>If I do something like this:<div><div><br></div><div><font face="Courier New">#lang typed/racket</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">(: v : (U (Vectorof Index)</font></div><div><font face="Courier New"> (Vectorof Integer)))</font></div><div><font face="Courier New">(define v #(0))</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">(ann (vector-ref v 0) Integer)</font></div></div><div><br></div><div>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?</div><div><br></div><div>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? </div><div><br></div></div><div><br></div></body></html>