From d199010f3a0ce8794b3b2b6964e86259190ca3f7 Mon Sep 17 00:00:00 2001 From: Stavros Aronis Date: Mon, 21 Mar 2011 18:34:12 +0200 Subject: Add small/confusing_record_warning --- .../small_SUITE_data/src/confusing_record_warning.erl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/dialyzer/test/small_SUITE_data/src/confusing_record_warning.erl (limited to 'lib/dialyzer/test/small_SUITE_data/src') diff --git a/lib/dialyzer/test/small_SUITE_data/src/confusing_record_warning.erl b/lib/dialyzer/test/small_SUITE_data/src/confusing_record_warning.erl new file mode 100644 index 0000000000..8af74e0914 --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/src/confusing_record_warning.erl @@ -0,0 +1,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>>}. -- cgit v1.2.3