Skip to content

Commit

Permalink
Fix dialyzer warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Dalgona committed Feb 4, 2020
1 parent a54c25c commit 9922487
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions lib/serum/build/file_processor/post_list.ex
Expand Up @@ -4,8 +4,10 @@ defmodule Serum.Build.FileProcessor.PostList do
require Serum.Result, as: Result
import Serum.IOProxy, only: [put_msg: 2]
alias Serum.Error
alias Serum.Post
alias Serum.PostList
alias Serum.Project
alias Serum.Tag

@type tag_groups() :: [{Tag.t(), [Post.t()]}]
@type tag_counts() :: [{Tag.t(), integer()}]
Expand Down
1 change: 1 addition & 0 deletions lib/serum/fragment.ex
Expand Up @@ -97,6 +97,7 @@ defmodule Serum.Fragment do
defprotocol Source do
@moduledoc false

alias Serum.Fragment
alias Serum.Result

@spec to_fragment(term()) :: Result.t(Fragment.t())
Expand Down
2 changes: 1 addition & 1 deletion lib/serum/header_parser.ex
Expand Up @@ -85,7 +85,7 @@ defmodule Serum.HeaderParser do
end
end

@spec find_missing([{binary(), binary()}], [atom()], integer()) :: Result.t()
@spec find_missing([{binary(), binary()}], [atom()], integer()) :: Result.t({})
defp find_missing(kv_list, required, line) do
req_strings = required |> Enum.map(&to_string/1) |> MapSet.new()
keys = kv_list |> Enum.map(&elem(elem(&1, 0), 0)) |> MapSet.new()
Expand Down
1 change: 1 addition & 0 deletions lib/serum/page.ex
Expand Up @@ -107,6 +107,7 @@ defmodule Serum.Page do
end

defimpl Fragment.Source do
alias Serum.Fragment
alias Serum.Page
alias Serum.Result

Expand Down
4 changes: 2 additions & 2 deletions lib/serum/plugin/loader.ex
Expand Up @@ -93,7 +93,7 @@ defmodule Serum.Plugin.Loader do
exception -> Result.fail(Exception, [exception, __STACKTRACE__])
end

@spec validate_elixir_version(binary(), Version.requirement()) :: Result.t()
@spec validate_elixir_version(binary(), Version.requirement()) :: Result.t({})
defp validate_elixir_version(name, requirement) do
if Version.match?(@elixir_version, requirement) do
Result.return()
Expand All @@ -108,7 +108,7 @@ defmodule Serum.Plugin.Loader do
end
end

@spec validate_serum_version(binary(), Version.requirement()) :: Result.t()
@spec validate_serum_version(binary(), Version.requirement()) :: Result.t({})
defp validate_serum_version(name, requirement) do
if Version.match?(@serum_version, requirement) do
Result.return()
Expand Down
1 change: 1 addition & 0 deletions lib/serum/post.ex
Expand Up @@ -109,6 +109,7 @@ defmodule Serum.Post do
end

defimpl Fragment.Source do
alias Serum.Fragment
alias Serum.Post
alias Serum.Result

Expand Down
1 change: 1 addition & 0 deletions lib/serum/post_list.ex
Expand Up @@ -149,6 +149,7 @@ defmodule Serum.PostList do
end

defimpl Fragment.Source do
alias Serum.Fragment
alias Serum.PostList
alias Serum.Result

Expand Down
2 changes: 1 addition & 1 deletion lib/serum/project.ex
Expand Up @@ -42,7 +42,7 @@ defmodule Serum.Project do
pagination: boolean(),
posts_per_page: pos_integer(),
preview_length: non_neg_integer(),
plugins: [Plugin.plugin_spec()],
plugins: [Plugin.spec()],
theme: Theme.t()
}

Expand Down
2 changes: 1 addition & 1 deletion lib/serum/result.ex
Expand Up @@ -77,7 +77,7 @@ defmodule Serum.Result do
defp indented(str, depth), do: [List.duplicate(" ", depth - 1), :red, "- ", :reset, str]

@doc "Binds the value of the given `result` to `fun`."
@spec bind(Result.t(a), (a -> Result.t(b))) :: Result.t(b) when a: term(), b: term()
@spec bind(t(a), (a -> t(b))) :: t(b) when a: term(), b: term()
def bind(result, fun)
def bind({:ok, value}, fun), do: fun.(value)
def bind({:error, %Error{}} = error, _fun), do: error
Expand Down

0 comments on commit 9922487

Please sign in to comment.