This is indeed caused by the optimizer removing needed code. Here's a smaller version:
#lang typed/racket (struct (A) foo ([x : A])) (struct (A) baz foo ()) (define (f [i : Integer]) : (foo Integer) (baz i)) (if (baz? (f 1)) 1 2) Sam On Wed, Sep 30, 2015 at 5:37 PM, Antonio Menezes Leitao <[email protected]> wrote: > Here is a small example that shows the problem: > > #lang typed/racket > > (struct (A) foo > ([x : A])) > > (struct (A) bar foo ()) > > (struct (A) baz foo ()) > > (define (make-foo [i : Integer]) : (foo Integer) > (if (even? i) > (bar i) > (baz i))) > > (define foos (map make-foo '(1 2 3 4 5 6))) > > (list (baz? (car foos)) (if (baz? (car foos)) 1 2)) > > ;;(#t 1) with #lang typed/racket/no-check > ;;(#t 2) with #lang typed/racket > > > Note that if you remove the return type declaration (foo Integer) from > make-foo, it computes the correct result. > > Thanks in advance for your help. > > Best, > António. > > > -- > You received this message because you are subscribed to the Google Groups > "Racket Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/racket-dev/CAJQmiZXgh_OK8s5mqUXdrshKneHz%2BuJ8QOifUnkz3K4LfTXS8w%40mail.gmail.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-dev/CAK%3DHD%2BYb1Mhk%2BREj4pbHJ91dPQhC6yhVUD5ZkRgivR8pMuXZwg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
