Error message needs more info: The type of the function _____, called on line ___ doesn't match the surrounding calling context.
#484
Labels
This particular error message is insufficiently precise, which makes it hard to debug. It shows the type of the function that is trying to be called, but not what the args to the function are that causes this check to fail.
Example:
(This comes from
gradualizer_fmt:format_type_error/2
, the clause that looks like this:format_type_error({type_error, call_intersect, Anno, FunTy, Name}, Opts)
).Here is a better error message:
(This comes from
gradualizer_fmt:format_expr_type_error/4
.) Note that it says what the type actually is,integer() | float()
, along with the expected typebinary()
, so it's much easier to see what the problem is.How to reproduce?
There is probably a better way to do this. I'm not familiar enough with Gradualizer to provide an isolated test case. However, I've been running into this on my
gradient
PR here: esl/gradient#124 . Pull the branch specified there, which is https://github.com/japhib/gradient and branchumbrella-config
, and runmix gradient
on the project itself.The text was updated successfully, but these errors were encountered: