ElixirRetry
ElixirRetry copied to clipboard
Add `generated: true` to macro to prevent Dialyzer errors
I am running into issues locally when trying to use retry and Dialyzer together.
When matching on tagged {:error, msg} tuples, I get a Dialyzer error that the pattern can never match :error, and if I match on an :error atom, I get a Dialyzer error that it can never match a tuple {_, _}. If I match on both:
lib/joydrive_web/services/oem_incentive_manager.ex:113:pattern_match
The pattern can never match the type.
Pattern:
:error
Type:
{_, _}
________________________________________________________________________________
lib/joydrive_web/services/oem_incentive_manager.ex:114:pattern_match
The pattern can never match the type.
Pattern:
{:error, _error}
Type:
:error
Passing the following into the macro makes no difference:
retry with: [2], atoms: [:error] do
I propose adding generated: true to the macro to keep Dialyzer from complaining.
Thanks for the PR @danadaldos. We've had a few Dialyzer issues previously, so I'm thinking of finally adding type specs to the library and will consider your PR as part of that.
@safwank If it resolves Dialyzer issues, why do not merge it? It would be helpful for many people.
:pray: