For this function:

(define (f [x : (U Integer Boolean)])
  (if (integer? x) (add1 x) "1"))

Typed Racket infers the type:

(-> (U Boolean Integer) (U Integer String))

and also recognizes this equivalent case-> type:

(ann f : (case-> (-> Boolean (U Integer String))
                 (-> Integer (U Integer String))))

but does not recognize this correct type:

(ann f : (case-> (-> Boolean String)
                 (-> Integer Integer)))
=>
Type Checker: type mismatch
  expected: (case-> (-> Boolean String) (-> Integer Integer))
  given: (-> (U Boolean Integer) (U Integer String)) in: f

Is there a reason TR cannot compute the last type? Is it a performance issue?

-- 
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/CAFfiA1LrzJkVgTQHTF59XXbiMMrmUFycV0cCZnMApqteQmEMcg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to