Skip to content

Dialyzer warnings because of bad parameters passed #46

Description

@Sinc63

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
  • Operating system:

Current behavior

lib/frame/settings.ex:29:pattern_match
The pattern can never match the type.

Pattern:
{:error, _code, __settings}

Type:

{:ok,
%Kadabra.Connection.Settings{
:enable_push => true,
:header_table_size => 4096,
:initial_window_size => 65535,
:max_concurrent_streams => :infinite,
:max_frame_size => 16384,
:max_header_list_size => nil
}}


lib/frame/settings.ex:44:call
The function call will not succeed.

Kadabra.Connection.Settings.put(
_settings :: %Kadabra.Connection.Settings{
:enable_push => true,
:header_table_size => 4096,
:initial_window_size => 65535,
:max_concurrent_streams => :infinite,
:max_frame_size => 16384,
:max_header_list_size => nil
},
_ident :: char(),
_value :: non_neg_integer()
)

breaks the contract
(t(), non_neg_integer(), term()) :: {:ok, t()} | {:error, binary(), t()}

Include code samples, errors and stacktraces if appropriate.

Expected behavior

The call to put_settings is passing a binary when the function is expecting a number. Either the caller or the function needs to translate the string from, for example, 'enable_push' to 2 so that the code in frame/settings will work. The first error appears to only occur because of the second one, because all the invalid parameters will drop through to the default handler and only return :ok.

Note that there is no test module for frame/settings.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions