Re:Changelog for Elixir v1.11
by elcritch on Saturday September 12, 2020 @03:34PM
(#24454898)
Dialyzer messages can be pretty obtuse. Usually I take it as a cue to just re-read the function and it's often somewhat clear where the problem lies due to immutability (not always though).
Another trick I'll do, is to use (abuse) pattern matching:
def foo(%SomeStruct{} = arg, value) when is_integer(value) ...
That also helps Dialyzer narrow down possibilities too and will blow up on runtime.
If you use VSCode, the ElixirLS module will auto-suggest @spec's for your functions.
Another trick I'll do, is to use (abuse) pattern matching:
That also helps Dialyzer narrow down possibilities too and will blow up on runtime.If you use VSCode, the ElixirLS module will auto-suggest @spec's for your functions.