diff options
author | Stavros Aronis <[email protected]> | 2011-03-21 18:34:12 +0200 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2011-05-04 15:06:16 +0200 |
commit | d199010f3a0ce8794b3b2b6964e86259190ca3f7 (patch) | |
tree | 7333459d0d7284db08daed0bfaca480a70f79ba6 /lib | |
parent | 35984f11f0411b09bc945273d7faa0b4ed8b6e66 (diff) | |
download | otp-d199010f3a0ce8794b3b2b6964e86259190ca3f7.tar.gz otp-d199010f3a0ce8794b3b2b6964e86259190ca3f7.tar.bz2 otp-d199010f3a0ce8794b3b2b6964e86259190ca3f7.zip |
Add small/confusing_record_warning
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dialyzer/test/small_SUITE_data/results/confusing_record_warning | 3 | ||||
-rw-r--r-- | lib/dialyzer/test/small_SUITE_data/src/confusing_record_warning.erl | 19 |
2 files changed, 22 insertions, 0 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/results/confusing_record_warning b/lib/dialyzer/test/small_SUITE_data/results/confusing_record_warning new file mode 100644 index 0000000000..ac3d89b02b --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/results/confusing_record_warning @@ -0,0 +1,3 @@ + +confusing_record_warning.erl:18: Function test/1 has no local return +confusing_record_warning.erl:18: Matching of pattern {'r', [_]} tagged with a record name violates the declared type of #r{field::'binary' | 'undefined'} 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>>}. |