Closed sax closed 2 years ago
This project doesn't have anything to do with the warnings that are generated, that is all handled by Erlang's dialyzer library; so in the unlikely event its a dialyzer bug its a bug in the OTP tracker (you'd need to reproduce in Erlang). I'd ask on the Elixir forums, like you said its usually code. I've struggled with some of these as well and its always my code.
Thanks! I'll head to the Elixir forums.
Precheck
√ Take a look at the open issues and be sure that your issue is not already covered. √ Be sure your versions of Dialyxir and Erlex are up to date.
Environment
Elixir & Erlang/OTP versions (elixir --version):
Which version of Dialyxir are you using? (cat mix.lock | grep dialyxir):
Current behavior
I'm using a
with
statement that may return two different patterns. I use this same with statement twice. In one of the statements, dialyxer (or maybe dialyzer?) only sees the return values from one of the patterns.Here is the code, pinned to a specific commit: https://github.com/geometerio/dyd/blob/fee50b18962f0f63dfbe411b242c8c5a87f47dd7/lib/dyd.ex#L101
Here is the second usage, which does not generate a dialyzer warning: https://github.com/geometerio/dyd/blob/fee50b18962f0f63dfbe411b242c8c5a87f47dd7/lib/dyd.ex#L136
Here is the spec that should make the statement valid: https://github.com/geometerio/dyd/blob/fee50b18962f0f63dfbe411b242c8c5a87f47dd7/lib/dyd/manifest.ex#L41
So far every time I've fought with dialyzer, it's been my own fault—it's helped me to catch incorrect specs and incorrect code. Apologies if it's something I've gotten wrong in the code... I'm stumped on this one, though.
Expected behavior
with
statement should be matched inelse
clauses.with
statements should generate the same dialyzer warnings (or lack thereof).