improper_list_construction.ex (732B)
1 defmodule Dialyxir.Warnings.ImproperListConstruction do 2 @behaviour Dialyxir.Warning 3 4 @impl Dialyxir.Warning 5 @spec warning() :: :improper_list_constr 6 def warning(), do: :improper_list_constr 7 8 @impl Dialyxir.Warning 9 @spec format_short([String.t()]) :: String.t() 10 def format_short(args), do: format_long(args) 11 12 @impl Dialyxir.Warning 13 @spec format_long([String.t()]) :: String.t() 14 def format_long([tl_type]) do 15 pretty_type = Erlex.pretty_print_type(tl_type) 16 17 "List construction (cons) will produce an improper list, " <> 18 "because its second argument is #{pretty_type}." 19 end 20 21 @impl Dialyxir.Warning 22 @spec explain() :: String.t() 23 def explain() do 24 Dialyxir.Warning.default_explain() 25 end 26 end