emacs-elsa/Elsa

Incorrect overload analysis when the input is a "sum" type, but individual type would succeed

Fuco1 opened this issue · 0 comments

Fuco1 commented

In case x is int, the first overload could be used, in case x is float, the second could be used. We can't determine the return type (it's int or float) but the call can definitely happen.

image

;; (a :: (and (function (int) int) (function (float) float)))
(defun a (x)
  "asd"
  (cond
   (nil (1+ x))
   ((integerp x) (1+ x))
   ((floatp x) (1+ x))
   (t (error "Impossible"))))


(integerp (a 1.0))
(stringp (a 1))


;; (a :: (and (function (int) int) (function (float) float)))