aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/small_SUITE_data/src/confusing_record_warning.erl
blob: 8af74e0914726969eda6d489f6ee5d7acebb2df1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
%%---------------------------------------------------------------------
%% A user complained that dialyzer produces a weird warning for the
%% following program.  I explained to him that there is an implicit
%% assumption that when a record is typed one cannot have types of
%% the same size which are tagged by the record name whose elements
%% have different types than the ones declared in the record.
%%
%% But the warning from dialyzer was weird nonetheless:
%%    The pattern {'r', [_]} can never match the type any()
%% We should clearly give some less confusing warning in this case.
%%---------------------------------------------------------------------
-module(confusing_record_warning).

-export([test/1]).

-record(r, {field :: binary}).

test({r, [_]}) ->
  #r{field = <<42>>}.