Last active
April 22, 2016 08:45
-
-
Save BjRo/eca4de6020dc41616ebeb4ed88a85fc6 to your computer and use it in GitHub Desktop.
Dialyzer, who knows what's going on?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Messages.Time do | |
use Timex | |
@spec timestamp() :: Timex.DateTime.t | |
def timestamp, do: Timex.DateTime.now(:utc) | |
@type ts :: Timex.Convertable.t | none | |
@spec timestamp_iso8601(ts) :: binary | |
def timestamp_iso8601(ts \\ __MODULE__.timestamp) do | |
{:ok, iso8601} = Timex.format(ts, "{ISO:Extended}") | |
String.replace(iso8601, "+00:00", "Z") | |
end | |
end | |
# lib/messages/time.ex:13: Function timestamp_iso8601/0 has no local return | |
# lib/messages/time.ex:13: The call 'Elixir.Messages.Time':timestamp_iso8601(#{}) will never return since it differs in the 1st argument from the success typing arguments: ('Elixir.Timex.Convertable') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Btw, if making a PR, you can try to fix timex locally to verify that your fix is correct. Basically, you edit the code in
deps/timex
, runmix compile timex
, and then verify that dialyzer passes.