aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/small_SUITE_data/src/false_false.erl
blob: e8efc428687165eefae59ff5e02235c63bac41ac (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
25
26
27
28
29
30
31
32
%%----------------------------------------------------------------------------
%% Mail from user (username: sauron!) via Dan Gudmundsson (17 Dec 2010).
%%
%%   tried this on:
%%     Erlang R14B (erts-5.8.1.2) [smp:2:2] [rq:2] [async-threads:0] ...
%%   and got funny diagnostics from dialyzer
%%
%%   false_false.erl:20: Function false_or/0 has no local return
%%   false_false.erl:25: The variable _ can never match since previous
%%		         clauses completely covered the type 'ok'
%%
%% Problem in the handling of 'or' with constant 'false' arguments
%% fixed by Stavros Aronis and Maria Christakis on the same day.
%%----------------------------------------------------------------------------
-module(false_false).

-export([false_or/0, wips/0]).

false_or() ->
  false or false.

wips() ->
  case new_execute_cmd(random:uniform(2)) of
    ok -> mostly_good;
    _ -> and_here_we_are
  end.

new_execute_cmd(1) ->
  ok;
new_execute_cmd(2) ->
  io:format("Surprise result is: ~p~n", [false or false]),
  false.