aboutsummaryrefslogblamecommitdiffstats
path: root/lib/dialyzer/test/small_SUITE_data/src/inv_mult.erl
blob: 34135568137ef5cce9524cb9e17df84ac35f0b81 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                                
%% Dialyzer was too constraining when checking the relation between the
%% arguments and result of a multiplication. We should not constrain an argument
%% if the other operand *may* be zero.
%%
%% Bug found by Kostis Sagonas, fixed by Stavros Aronis

-module(inv_mult).
-compile(export_all).

main(L) ->
    N = -1 * length(L),
    fact(N).

fact(0) -> 1;
fact(N) -> N * fact(N-1).