elixir-xml_rpc icon indicating copy to clipboard operation
elixir-xml_rpc copied to clipboard

Wrong type for XMLRPC.Fault faut_code causes dialyzer warning

Open graham2071 opened this issue 9 months ago • 0 comments

The following code

    case XMLRPC.decode!(body) do
      %XMLRPC.Fault{fault_code: 2} -> IO.inspect("fault 2")
    end

makes dialyzer complain:

The pattern can never match the type.

Pattern:
%XMLRPC.Fault{:fault_code => 2}

Type:
%{
  :__struct__ => XMLRPC.Fault | XMLRPC.MethodCall | XMLRPC.MethodResponse,
  :fault_code => Integer,
  :fault_string => binary(),
  :method_name => binary(),
  :param =>
    false
    | nil
    | true
    | binary()
    | [false | nil | true | binary() | number()]
    | number()
    | map(),
  :params => [
    false
    | nil
    | true
    | binary()
    | [false | nil | true | binary() | number()]
    | number()
    | map()
  ]
}

The type is defined as:

    @type t :: %__MODULE__{fault_code: Integer, fault_string: String.t}

I suppose it should be integer instead of Integer

graham2071 avatar May 16 '24 14:05 graham2071