<p dir="ltr">Are you using head from the last day or so. I recently pushed fixes for multiple annotations on the same form. If so can you file a minimal test case as a bug?</p>
<div class="gmail_quote">On May 11, 2014 6:15 PM, "Alexander D. Knauth" <<a href="mailto:alexander@knauth.org">alexander@knauth.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div>I tried this:</div><div><div><font face="Courier New">(define-syntax-rule</font></div><div><font face="Courier New"> (case/type x-expr</font></div><div><font face="Courier New"> [t body ...] ...)</font></div>
<div><font face="Courier New"> (let ([x x-expr])</font></div><div><font face="Courier New"> (cond [((ann (make-predicate t) (Any -> Boolean : #:+ (t @ x-expr) #:- (! t @ x-expr)))</font></div><div><font face="Courier New"> x)</font></div>
<div><font face="Courier New"> body ...]</font></div><div><font face="Courier New"> ...))</font></div><div><font face="Courier New"> )</font></div></div><div>But it gave me these errors:</div><div><div>
<font face="Courier New">. Type Checker: type mismatch</font></div><div><font face="Courier New"> expected: (-> Any Boolean)</font></div><div><font face="Courier New"> given: (-> Any Boolean : String) in: (make-predicate t)</font></div>
<div><font face="Courier New">. Type Checker: type mismatch</font></div><div><font face="Courier New"> expected: (-> Any Boolean)</font></div><div><font face="Courier New"> given: (-> Any Boolean : (Listof Any)) in: (make-predicate t)</font></div>
</div><div>Even though I put the filters in, and if it’s ignoring my filters, then shouldn’t (-> Any Boolean : Type) be a subtype of (-> Any Boolean)? </div><br><div><div>On May 11, 2014, at 8:54 PM, Alexander D. Knauth <<a href="mailto:alexander@knauth.org" target="_blank">alexander@knauth.org</a>> wrote:</div>
<br><blockquote type="cite"><div style="word-wrap:break-word"><br><div><div>On May 11, 2014, at 7:41 PM, Eric Dobson <<a href="mailto:eric.n.dobson@gmail.com" target="_blank">eric.n.dobson@gmail.com</a>> wrote:</div>
<br><blockquote type="cite">The issue is that there is a temporary variable that has the same<br>value as x and TR cannot see that they point to the same location.<br>Your implementation of case/type has the same problem. I thought there<br>
was a bug filed for it but couldn't find it so just filed one.<br><a href="http://bugs.racket-lang.org/query/?cmd=view&pr=14502" target="_blank">http://bugs.racket-lang.org/query/?cmd=view&pr=14502</a><br></blockquote>
<br><blockquote type="cite">Use this:<br>#lang typed/racket<br>(require typed/rackunit)<br><br>(define-syntax-rule<br> (case/type y x-expr<br> [t1 body ...] ...)<br> (let ([y x-expr])<br> (cond [((make-predicate t1) y) body ...] ...))<br>
)<br></blockquote><div><div>This worked:</div><div><font face="Courier New">#lang typed/racket</font></div><div><font face="Courier New">(require typed/rackunit)</font></div><div><font face="Courier New">(require syntax/parse/define)</font></div>
<div><font face="Courier New"><br></font></div><div><font face="Courier New">(define-simple-macro</font></div><div><font face="Courier New"> (case/type x:id</font></div><div><font face="Courier New"> [t:expr body:expr ...+] ...)</font></div>
<div><font face="Courier New"> (cond [((make-predicate t) x) body ...] ...)</font></div><div><font face="Courier New"> )</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">(define (my-length x)</font></div>
<div><font face="Courier New"> (case/type x</font></div><div><font face="Courier New"> [String (string-length x)]</font></div><div><font face="Courier New"> [(Listof Any) ((inst length Any) x)]</font></div><div><font face="Courier New"> ;[VectorTop (vector-length x)]</font></div>
<div><font face="Courier New"> ))</font></div><div><font face="Courier New">(check-equal? (my-length "12345") 5)</font></div><div><font face="Courier New">(check-equal? (my-length '(1 2 3 4 5)) 5)</font></div>
<div><font face="Courier New">;(check-equal? (my-length #(1 2 3 4 5)) 5)</font></div></div><br></div>Would something like that work for the typed version of case? <div><br></div></div>____________________<br> Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br></blockquote></div><br></div></blockquote></div>