Do you use Dialyzer in your projects?

As someone who is working a lot with Typespecs, for instance while working on the library TypeCheck, here’s some of the struggles I have with using Dialyzer:

  • Adding it into any project of reasonable size is slow, sometimes unsustainably so.
  • When it reports a problem, it is often very unclear why it is caused, and even moreso how it might be fixed. For example, help with this long-standing ‘function call with opaqueness mitchmatch’ problem would be greatly appreciated.
  • Elixir’s standard library itself does not follow Dialyzer’s opaqueness rules correctly, and fixing this would be a difficult and backwards-incompatible change. Essentially this means that pattern-matching on “pattern matching on the struct name allowed” structs like MapSets will make Dialyzer complain about usage which is recommended by Elixir’s official documentation. (Source: elixir/#8463 and elixir/#8480)

However, I still use it regularly, especially on smaller and simpler projects. I like the ‘belt ánd suspenders’ kind of approach w.r.t. detecting potential bugs early.
And as @eksperimental already noted: Gradient/Gradualizer is a wonderful new project, and very much worth keeping check on!

8 Likes