zf

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

binary_construction.ex (793B)


      1 defmodule Dialyxir.Warnings.BinaryConstruction do
      2   @behaviour Dialyxir.Warning
      3 
      4   @impl Dialyxir.Warning
      5   @spec warning() :: :bin_construction
      6   def warning(), do: :bin_construction
      7 
      8   @impl Dialyxir.Warning
      9   @spec format_short([String.t()]) :: String.t()
     10   def format_short([culprit | _]) do
     11     "Binary construction with #{culprit} will fail."
     12   end
     13 
     14   @impl Dialyxir.Warning
     15   @spec format_long([String.t()]) :: String.t()
     16   def format_long([culprit, size, segment, type]) do
     17     pretty_type = Erlex.pretty_print_type(type)
     18 
     19     "Binary construction will fail since the #{culprit} field #{size} in " <>
     20       "segment #{segment} has type #{pretty_type}."
     21   end
     22 
     23   @impl Dialyxir.Warning
     24   @spec explain() :: String.t()
     25   def explain() do
     26     Dialyxir.Warning.default_explain()
     27   end
     28 end