aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/small_SUITE_data/src/exhaust_case.erl
blob: 4b2c16f8a2fc827119d0761a90da5ad21e58dcd8 (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
%%-------------------------------------------------------------------
%% 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.