aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/small_tests_SUITE_data/src/exhaust_case.erl
blob: 6b20c7c98c127264f26d9a44a428dc7b08104c82 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
%%-------------------------------------------------------------------
%% File    : exhaust_case.erl
%% Author  : Kostis Sagonas <[email protected]>
%% Description : Tests that Dialyzer warns when it finds an unreachable
%%		 case clause (independently of whether ground vs. var).
%%
%% Created : 15 Dec 2004 by Kostis Sagonas <[email protected]>
%%-------------------------------------------------------------------

-module(exhaust_case).
-export([t/1]).

t(X) when is_integer(X) ->
  case ret(X) of
    foo -> ok;
    bar -> ok;
    42  -> ok;
    _other -> error	%% unreachable clause (currently no warning)
    %% other -> error	%% but contrast this with this clause... hmm
  end.

ret(1) -> foo;
ret(2) -> bar.