ElixirRetry icon indicating copy to clipboard operation
ElixirRetry copied to clipboard

Add `generated: true` to macro to prevent Dialyzer errors

Open danadaldos opened this issue 4 years ago • 1 comments

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.

danadaldos avatar May 25 '21 17:05 danadaldos

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 avatar May 30 '21 07:05 safwank

@safwank If it resolves Dialyzer issues, why do not merge it? It would be helpful for many people.

vilix13 avatar Aug 24 '22 10:08 vilix13

:pray:

danadaldos avatar Aug 27 '22 14:08 danadaldos