Skip to content

Commit

Permalink
Ignore dialyzer warning
Browse files Browse the repository at this point in the history
Because real world could have attribute value undefined,
which violates the type spec for #xmlstreamstart{}
  • Loading branch information
arcusfelis committed Jun 19, 2024
1 parent f8aba39 commit 073f925
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/c2s/mongoose_c2s.erl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

-ignore_xref([get_ip/1, get_socket/1, instrumentation/1]).

%% The pattern 'undefined' can never match the type binary()
-dialyzer({no_match, patch_attr_value/1}).

-record(c2s_data, {
host_type :: undefined | mongooseim:host_type(),
lserver = ?MYNAME :: jid:lserver(),
Expand Down Expand Up @@ -282,6 +285,7 @@ patch_element(El = #xmlstreamstart{attrs = Attrs}) ->
patch_element(El) ->
El.

-spec patch_attr_value(undefined | binary()) -> binary().
patch_attr_value(undefined) -> <<>>;

Check warning on line 289 in src/c2s/mongoose_c2s.erl

View check run for this annotation

Codecov / codecov/patch

src/c2s/mongoose_c2s.erl#L289

Added line #L289 was not covered by tests
patch_attr_value(Bin) -> Bin.

Expand Down

0 comments on commit 073f925

Please sign in to comment.