Don't allow comparison of just anything
I know this is a feature that is supported by Erlang and the documentation even explains how it works but I feel Gradualizer could figure out if something should be compared or no.
-spec test() -> boolean().
test() ->
{cm, 42} < 43.
We've had similar discussions elsewhere but it's good to have it again! I think we should not fail on this. It is a bit inefficient but it's not wrong. Could be the result of code generation!
I think and always thought that we should allow this.
The total order of terms is used in things like balanced trees where the keys can be anything.
Could we issue a different kind of warning possibly that needs to be enabled? Kind of like a pedantic flag?
Perhaps we can add an option! This whole project is experimental and we have experimental options to tweak the behaviour already. It should affect all the comparisons operators then.
Another thing which is more of a style preference is the use of orelse and andalso where the second operand is not a boolean. That is perfectly valid in Erlang, but some think it's wrong/bad. We could have an option for that too.