The type in the @spec does not completely cover the types returned by function.
defmodule Example do @spec ok(:ok | :error) :: :ok def ok(:ok) do :ok end def ok(:error) do :error end end