alexgaribay / sendgrid_elixir

Create and send composable emails with Elixir and SendGrid.
MIT License
86 stars 44 forks source link

Email.put_phoenix_template spec should allow lists of any length #31

Closed localshred closed 5 years ago

localshred commented 5 years ago

Previously, dialyzer reports usage of Email.put_phoenix_template with non-empty assigns as an invalid use of the function. This simple change informs dialyzer that invocations should allow empty or non-empty keyword lists.

Failing Example:

def tester() do
  # Dialyzer does not complain about this invocation
  test([])

  # Dialyzer complains here that the given argument
  # breaks the contract
  test(foo: "bar")
end

# Using a bare list `[]` here denotes only empty lists are valid arguments
@spec test([]) :: any()
def test(assigns) do
  assigns
end

Working Example:

def tester() do
  # Dialyzer does not complain about either invocation
  test([])
  test(foo: "bar")
end

@spec test(list()) :: any()
def test(assigns) do
  assigns
end
alexgaribay commented 5 years ago

👍

localshred commented 5 years ago

Thanks for merging @alexgaribay! Do you have any idea when you'll cut the next release?

alexgaribay commented 5 years ago

Hopefully soon. I'm working on some enhancements that I want to go in to the next version before I release.

localshred commented 5 years ago

Sounds great, thanks again!