Skip to content

Commit

Permalink
fix: typespec in generated code (#561)
Browse files Browse the repository at this point in the history
A small typespec fix.

`@spec` for `deliver_now/2` when using `Bamboo.Mailer` defines tuple
for when we call it with `response: true` option.

However the slots in the tuple are reversed from actual implementation,
causing dialyzer warning in our code.

Impl is:
```ex
      response = adapter.deliver(email, config)
      {email, response}
```
https://github.com/thoughtbot/bamboo/blob/8c5780319c5e2c936d04a2e1d9594be20a525c9b/lib/bamboo/mailer.ex#L149-L150
  • Loading branch information
ymtszw authored Nov 5, 2020
1 parent 8c57803 commit a479fd4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bamboo/mailer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ defmodule Bamboo.Mailer do

defmacro __using__(opts) do
quote bind_quoted: [opts: opts] do
@spec deliver_now(Bamboo.Email.t(), Enum.t()) :: Bamboo.Email.t() | {any, Bamboo.Email.t()}
@spec deliver_now(Bamboo.Email.t(), Enum.t()) :: Bamboo.Email.t() | {Bamboo.Email.t(), any}
def deliver_now(email, opts \\ []) do
{config, opts} = Keyword.split(opts, [:config])
config = build_config(config)
Expand Down

0 comments on commit a479fd4

Please sign in to comment.