DockYard / elixir-mail

Build composable mail messages
392 stars 64 forks source link

fix type for dialyzer #135

Closed andrew-lewin closed 3 years ago

andrew-lewin commented 3 years ago

We were running Dialyzer on our project and ran into some issues with this type definition being for the module rather than the struct. Once we made this change, Dialyzer stopped complaining about the types not matching.

Dialyzer output this resolves:

lib/mail/parsers/rfc_2822.ex:19:invalid_contract
The @spec for the function does not match the success typing of the function.

Function:
Mail.Parsers.RFC2822.parse/1

Success typing:
@spec parse(binary() | nonempty_maybe_improper_list()) :: %Mail.Message{
  :body => nil | binary(),
  :headers => map(),
  :multipart => boolean(),
  :parts => [any()]
}

Closes # .

Changes proposed in this pull request

bcardarella commented 3 years ago

Thanks!