[erlang-questions] Temporarily violating record type constraints annoys dialyzer

Fred Hebert mononcqc@REDACTED
Tue Nov 13 13:23:26 CET 2018

On 11/12, Krzysztof Jurewicz wrote:
>A similar problem arises if we try to use record syntax to construct generators for property testing:
> ...
>The tests pass, but Dialyzer complains. To silence it, we could rewrite 
>the property as:
> ...

That's interesting. I pretty much never run Dialyzer against test suites 
simply because there are cases where I want my tests to trigger failures 
and validate in/out of boundary conditions are being checked, sometimes 
to know if the right kind of exceptions is raised (or that the right 
logs are produced as side-effects)

Every time I purposefully send in data that breaks boundaries and raises 
exceptions which end up part of my program's contract even if it isn't 
part of its type annotations, Dialyzer is guaranteed to never pass.

One of the small unspoken "rules" or practices I have is to never run 
Dialyzer on test code because it never works super well for plenty of 
cases, particularly when your tests explicitly try to break things.

More information about the erlang-questions mailing list