zf

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

record_construction.ex (975B)


      1 defmodule Dialyxir.Warnings.RecordConstruction do
      2   @behaviour Dialyxir.Warning
      3 
      4   @impl Dialyxir.Warning
      5   @spec warning() :: :record_constr
      6   def warning(), do: :record_constr
      7 
      8   @impl Dialyxir.Warning
      9   @spec explain() :: String.t()
     10   def explain() do
     11     Dialyxir.Warning.default_explain()
     12   end
     13 
     14   @impl Dialyxir.Warning
     15   @spec format_short([String.t()]) :: String.t()
     16   def format_short([_types, name]) do
     17     "Record construction violates the declared type for #{name}."
     18   end
     19 
     20   def format_short([name, _field, _type]) do
     21     "Record construction violates the declared type for #{name}."
     22   end
     23 
     24   @impl Dialyxir.Warning
     25   @spec format_long([String.t()]) :: String.t()
     26   def format_long([types, name]) do
     27     "Record construction #{types} violates the declared type for ##{name}{}."
     28   end
     29 
     30   def format_long([name, field, type]) do
     31     "Record construction violates the declared type for ##{name}{}, " <>
     32       "because #{field} cannot be of type #{type}."
     33   end
     34 end