Fix dialyzer warnings

pull/162/head
Luke Imhoff 7 years ago
parent 7474dccbb6
commit a5277b5103
  1. 2
      .dialyzer-ignore
  2. 14
      apps/explorer/lib/explorer/chain.ex
  3. 1
      apps/explorer/lib/explorer/chain/address.ex

@ -1,5 +1,5 @@
:0: Unknown function 'Elixir.ExUnit.Callbacks':'__merge__'/3
:0: Unknown function 'Elixir.ExUnit.CaseTemplate':'__proxy__'/2
:0: Unknown type 'Elixir.Map':t/0
apps/explorer/lib/explorer/indexer/block_fetcher.ex:239: The created fun has no local return
apps/explorer/lib/explorer/indexer/block_fetcher.ex:246: The created fun has no local return
apps/explorer/lib/explorer/indexer/block_fetcher.ex:253: The created fun has no local return

@ -40,7 +40,7 @@ defmodule Explorer.Chain do
@typep inserted_after_option :: {:inserted_after, DateTime.t()}
@typep necessity_by_association_option :: {:necessity_by_association, necessity_by_association}
@typep pagination_option :: {:pagination, pagination}
@typep timestamps :: %{inserted_at: DateTime.t(), updated_at: DateTime.t()}
@typep timestamps :: %{inserted_at: %Ecto.DateTime{}, updated_at: %Ecto.DateTime{}}
@typep timestamps_option :: {:timestamps, timestamps}
# Functions
@ -757,7 +757,9 @@ defmodule Explorer.Chain do
* `:pagination` - pagination params to pass to scrivener.
"""
@spec recent_pending_transactions([inserted_after_option | necessity_by_association_option]) :: [Transaction.t()]
@spec recent_pending_transactions([inserted_after_option | necessity_by_association_option]) :: %Scrivener.Page{
entries: [Transaction.t()]
}
def recent_pending_transactions(options \\ []) when is_list(options) do
necessity_by_association = Keyword.get(options, :necessity_by_association, %{})
pagination = Keyword.get(options, :pagination, %{})
@ -924,7 +926,9 @@ defmodule Explorer.Chain do
* `:pagination` - pagination params to pass to scrivener.
"""
@spec transaction_hash_to_internal_transactions(Hash.Full.t()) :: [InternalTransaction.t()]
@spec transaction_hash_to_internal_transactions(Hash.Full.t()) :: %Scrivener.Page{entries: [InternalTransaction.t()]}
@spec transaction_hash_to_internal_transactions(Hash.Full.t(), [necessity_by_association_option | pagination_option]) ::
%Scrivener.Page{entries: [InternalTransaction.t()]}
def transaction_hash_to_internal_transactions(
%Hash{byte_count: unquote(Hash.Full.byte_count())} = hash,
options \\ []
@ -1073,6 +1077,7 @@ defmodule Explorer.Chain do
end)
end
@spec ecto_schema_module_to_changes_list_to_address_hash_set(%{module => [map()]}) :: MapSet.t(Hash.Truncated.t())
defp ecto_schema_module_to_changes_list_to_address_hash_set(ecto_schema_module_to_changes_list) do
Enum.reduce(ecto_schema_module_to_changes_list, MapSet.new(), fn ecto_schema_module_changes_list, acc ->
ecto_schema_module_changes_list
@ -1109,7 +1114,7 @@ defmodule Explorer.Chain do
)
end
@spec insert_addresses([map()], [timestamps_option]) :: {:ok, Block.t()} | {:error, [Changeset.t()]}
@spec insert_addresses([%{hash: Hash.Truncated.t()}], [timestamps_option, ...]) :: {:ok, [Hash.Truncated.t()]}
defp insert_addresses(changes_list, named_arguments) when is_list(changes_list) and is_list(named_arguments) do
timestamps = Keyword.fetch!(named_arguments, :timestamps)
@ -1261,6 +1266,7 @@ defmodule Explorer.Chain do
Enum.map(changes_list, &timestamp_params(&1, timestamps))
end
@spec timestamps() :: timestamps
defp timestamps do
now = Ecto.DateTime.utc()
%{inserted_at: now, updated_at: now}

@ -63,6 +63,7 @@ defmodule Explorer.Chain.Address do
|> unique_constraint(:hash)
end
@spec hash_set_to_changes_list(MapSet.t(Hash.Truncated.t())) :: [%{hash: Hash.Truncated.t()}]
def hash_set_to_changes_list(hash_set) do
Enum.map(hash_set, &hash_to_changes/1)
end

Loading…
Cancel
Save