1
%% Test case that results in a confusing warning -- created from a
2
%% very stripped down actual application. The second case clause of
3
%% test/1 cannot possibly match because all a-pairs match with the
4
%% first clause. Dialyzer complains that the second argument of the
5
%% second 2-tuple has type 'aaa' | 'bbb'. This is mucho confusing
6
%% since there is no 'a'-pair whose second element is 'aaa' | 'bbb'.
7
%% Pattern matching compilation is of course what's to blame here.
9
-module(confusing_warning).
12
test(N) when is_integer(N) ->
14
{a, I} when is_integer(I) ->
16
{a, {_, L}} -> % this clause cannot possibly match
21
foo(2) -> {b, aaa}; % this is really unused
22
foo(3) -> {b, bbb}. % this is really unused