ewildgoose / elixir-xml_rpc

Encode and decode elixir terms to XML-RPC parameters
Apache License 2.0
40 stars 17 forks source link

Wrong type for XMLRPC.Fault faut_code causes dialyzer warning #21

Closed graham2071 closed 3 months ago

graham2071 commented 6 months ago

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