Hi there.
This is probably a noob question, but I am trying to get the type checker to recognize that a particular binding is not nil:
(t/cf
(t/fn [[x y] :- '[String (t/Option Number)]] :- (t/U '[String] '[String Number])
;;(if (number? y) ;; works!
;;(if-not (nil? y) ;; doesn't work
(if y ;; doesn't work
[x y]
[x])))
Type Error (:30:5) Type mismatch:
Expected: (t/U (t/HVec [String]) (t/HVec [String Number]))
Actual: (t/HVec [String (t/U nil Number)])
in: [x y]
This is a simplification of a more complex case where I don't have a function like number? available.
Is there a way to prove to the checker that something is definitely not nil? (or a better overall approach I should look at)
Thanks!
Mark