Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type spec of Mailer.deliver_later/1 #584

Merged

Conversation

lasseebert
Copy link
Contributor

After updating to 2.0.0, my dialyzer fails with a message like this:

lib/my_app/mailer/mailgun.ex:17:invalid_contract
The @spec for the function does not match the success typing of the function.

Function:
MyApp.Mailer.Mailgun.BambooMailer.deliver_later/1

Success typing:
@spec deliver_later(_) ::
  {:error,
   <<_::64, _::size(8)>>
   | %{
       :__exception__ => true,
       :__struct__ => Bamboo.EmptyFromAddressError | Bamboo.NilRecipientsError,
       :message => <<_::64, _::size(8)>>
     }}
  | {:ok,
     %{
       :bcc => {binary(), binary()},
       :cc => {binary(), binary()},
       :from => {binary(), binary()},
       :to => {binary(), binary()},
       _ => _
     }}

________________________________________________________________________________
done (warnings were emitted)

This PR fixes that spec error.

@lasseebert
Copy link
Contributor Author

Note that this is not part of #583, since it seems that the generated functions inside __using__ are not dialyzed in that PR.

@germsvel
Copy link
Collaborator

Good catch! Thanks for opening this PR and thanks for the little note disambiguating from #583. Those kinds of notes are so helpful. 🎉

@germsvel germsvel merged commit 6636983 into beam-community:master Feb 23, 2021
@lasseebert lasseebert deleted the fix_type_spec_deliver_later branch February 24, 2021 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants