aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/small_SUITE_data/src/relevant_record_warning.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dialyzer/test/small_SUITE_data/src/relevant_record_warning.erl')
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/relevant_record_warning.erl23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/src/relevant_record_warning.erl b/lib/dialyzer/test/small_SUITE_data/src/relevant_record_warning.erl
new file mode 100644
index 0000000000..3ff65458df
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/src/relevant_record_warning.erl
@@ -0,0 +1,23 @@
+%% Formerly confusing_record_warning.erl.
+%% The warning output is relevant as of Erlang/OTP 17.1.
+%% The original comment kept below.
+
+%%---------------------------------------------------------------------
+%% 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(relevant_record_warning).
+
+-export([test/1]).
+
+-record(r, {field :: binary}).
+
+test({r, [_]}) ->
+ #r{field = <<42>>}.