jeremyjh / dialyxir

Mix tasks to simplify use of Dialyzer in Elixir projects.
Apache License 2.0
1.7k stars 140 forks source link

Wrong return types in the @specs are ignored? #531

Closed matteo-gheri-pocketworks closed 5 months ago

matteo-gheri-pocketworks commented 8 months ago

Environment

Screenshot 2024-01-25 at 13 27 30

Expected behavior

Highlight the error in function 2 suggesting the wrong spec?

Sinc63 commented 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.

jeremyjh commented 5 months ago

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.