zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

exact_equality.ex (870B)


      1 defmodule Dialyxir.Warnings.ExactEquality do
      2   @moduledoc """
      3   The expression can never evaluate to true.
      4 
      5   ## Example
      6 
      7       defmodule Example do
      8         def ok() do
      9           :ok == :error
     10         end
     11       end
     12   """
     13 
     14   @behaviour Dialyxir.Warning
     15 
     16   @impl Dialyxir.Warning
     17   @spec warning() :: :exact_eq
     18   def warning(), do: :exact_eq
     19 
     20   @impl Dialyxir.Warning
     21   @spec format_short([String.t()]) :: String.t()
     22   def format_short(args), do: format_long(args)
     23 
     24   @impl Dialyxir.Warning
     25   @spec format_long([String.t()]) :: String.t()
     26   def format_long([type1, op, type2]) do
     27     pretty_type1 = Erlex.pretty_print_type(type1)
     28     pretty_type2 = Erlex.pretty_print_type(type2)
     29 
     30     "The test #{pretty_type1} #{op} #{pretty_type2} can never evaluate to 'true'."
     31   end
     32 
     33   @impl Dialyxir.Warning
     34   @spec explain() :: String.t()
     35   def explain() do
     36     @moduledoc
     37   end
     38 end