aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/opaque_SUITE_data/src/opaque/opaque_bug4.erl
blob: a7ddc80fe8522e6417bfb026f0319af735ecf6ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
%%---------------------------------------------------------------------
%% A test for which the analysis gave wrong results due to erroneous
%% specialization and incorrect handling of unions.
%%---------------------------------------------------------------------

-module(opaque_bug4).

-export([ok/0, wrong/0]).

%-spec ok() -> 'ok'.
ok() ->
   L = opaque_adt:atom_or_list(42),
   foo(L).

%-spec wrong() -> 'not_ok'.
wrong() ->
   A = opaque_adt:atom_or_list(1),
   foo(A).

foo(a) -> not_ok;
foo([_|_]) -> ok.