coalton-lang/coalton

Unclear error message for heterogenous list

Izaakwltn opened this issue · 0 comments

The error message doesn't tell you explicitly that you have a list containing different types of objects.

(coalton-toplevel
  (define wut (make-list 1.0d0 2.0d0 3.0)))
error: Type mismatch
  --> repl input:3:4
   |
 3 |      (MAKE-LIST 1.0d0 2.0d0 3.0)))
   |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected type '(LIST DOUBLE-FLOAT)' but got '(LIST SINGLE-FLOAT)'
   [Condition of type COALTON-IMPL/TYPECHECKER/BASE:TC-ERROR]

The previous error message, according to the docs, was:

Failed to unify types SINGLE-FLOAT and INTEGER
in unification of types (INTEGER → (LIST SINGLE-FLOAT) → :A) and (:B → (LIST :B) → (LIST :B))
in definition of WUT
in COALTON-TOPLEVEL
   [Condition of type COALTON-IMPL/TYPECHECKER::COALTON-TYPE-ERROR-CONTEXT]