unknown_type.ex (961B)
1 defmodule Dialyxir.Warnings.UnknownType do 2 @moduledoc """ 3 Spec references a missing @type. 4 5 ## Example 6 7 defmodule Missing do 8 end 9 10 defmodule Example do 11 @spec ok(Missing.t()) :: :ok 12 def ok(_) do 13 :ok 14 end 15 end 16 """ 17 18 @behaviour Dialyxir.Warning 19 20 @impl Dialyxir.Warning 21 @spec warning() :: :unknown_type 22 def warning(), do: :unknown_type 23 24 @impl Dialyxir.Warning 25 @spec format_short({String.t(), String.t(), String.t()}) :: String.t() 26 def format_short({module, function, arity}) do 27 pretty_module = Erlex.pretty_print(module) 28 29 "Unknown type: #{pretty_module}.#{function}/#{arity}." 30 end 31 32 @impl Dialyxir.Warning 33 @spec format_long({String.t(), String.t(), String.t()}) :: String.t() 34 def format_long({module, function, arity}) do 35 format_short({module, function, arity}) 36 end 37 38 @impl Dialyxir.Warning 39 @spec explain() :: String.t() 40 def explain() do 41 @moduledoc 42 end 43 end