app_call.ex (970B)
1 defmodule Dialyxir.Warnings.AppCall do 2 @behaviour Dialyxir.Warning 3 4 @impl Dialyxir.Warning 5 @spec warning() :: :app_call 6 def warning(), do: :app_call 7 8 @impl Dialyxir.Warning 9 @spec format_short([String.t()]) :: String.t() 10 def format_short([_module, function | _]) do 11 "Module or function to apply is not an atom in #{function}." 12 end 13 14 @impl Dialyxir.Warning 15 @spec format_long([String.t()]) :: String.t() 16 def format_long([module, function, arity, culprit, expected_type, actual_type]) do 17 pretty_module = Erlex.pretty_print(module) 18 pretty_expected_type = Erlex.pretty_print_type(expected_type) 19 pretty_actual_type = Erlex.pretty_print_type(actual_type) 20 21 "The call #{pretty_module}.#{function}/#{arity} requires that " <> 22 "#{culprit} is of type #{pretty_expected_type}, not #{pretty_actual_type}." 23 end 24 25 @impl Dialyxir.Warning 26 @spec explain() :: String.t() 27 def explain() do 28 Dialyxir.Warning.default_explain() 29 end 30 end