Closed matteo-gheri-pocketworks closed 5 months ago
I don't think I mind having a spec that has extra bits. I'd be more worried about the fact that test_2 can clearly return :invalid and there is no complaint about that in regards to its spec or test_3's behaviour.
This is a question about dialyzer, which isn't part of this project. This project is just an Elixir integration with dialyzer. If I knew the answer here I'd tell you; I suspect there is a warning flag you can enable to get the desired behavior; the ones we enable by default are very basic. For help understanding the counter-intuitive behaviors of Dialyzer I recommend asking on the Elixir forums.
Environment
Elixir & Erlang/OTP versions (elixir --version): Erlang/OTP 25 and Elixir 1.14.0
Which version of Dialyxir are you using? (cat mix.lock | grep dialyxir): 1.4.3
Current behavior
Hello, just wanted to mention something I noticed. I've added a screenshot for simplicity. I got an error message in the case statement when test_3 calls test_2, it says
The pattern can never match the type. Pattern: :error Type: :valid
. But, the weird thing is, test_2's spec includes:error
too, although been wrong. It's easy to spot the issue here, but in real-world scenario, it's trickier (or at least has been for me 😅) to figure out with the current error message.Expected behavior
Highlight the error in function 2 suggesting the wrong spec?