core-typed 2024-05-18

For this function i'm getting an interesting warning: "WARNING: Local became bottom when checking case then". It doesn't give an error for that file just the warning. Can you explain why the type checker is giving me a warning?

(t/ann get-all-users [t/Str t/Int -> (t/Vec User)])
(defn get-all-users [sort-val page]
  (let [page (if (< page 1) 1 page)
        limit 20
        offset (* (dec page) limit)]

    (case sort-val
      ("sortval1" nil) (get-users page)

      "sortval2" (get-sortval2-users limit offset)

      "sortval3" (get-sortval3-users limit offset)

      "sortval4" (get-sortval4-users limit offset)

      [])))

It means that there's an unreachable case. Probably the nil case.

Oh because I have sort-val typed as a string thanks

👍 1