sax
Every time I run into an issue with dialyzer, it’s my fault. I respect that, and predict that it’s also the case here. I’m stumped with this one, though.
I’m using a with statement that may return two different matches. I use this same with statement twice. In one of the statements, dialyzer only sees the return values from one of the function calls.
If anyone has some spare moments to take a look at the code, I’d appreciate any pointers.
lib/dyd.ex:101:pattern_match
The pattern can never match the type.
Pattern:
{:error, {:invalid_toml, _error}}
Type:
{:error, :invalid_time_unit | :not_a_datetime}
Here is the offending line, 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 any warnings:
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
This is with the following versions:
- OTP: 24.2.1
- Elixir: 1.13.3
- Dialyxir: 1.1.0
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #elixirconf-us
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 2- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
al2o3cr
This may not be the same underlying issue, but the situation (
elseclauses withno_returnin each fail type analysis) sounds really similar:https://github.com/elixir-lang/elixir/issues/10385
or this (also linked to the same open issue):
https://github.com/elixir-lang/elixir/issues/7177
sax
Cool, thanks for the links! That gives me some ideas for how I could rewrite this to avoid the condition. Fortunately it’s a CLI app rather than a library, so I can let it sit for a little while.