aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/small_SUITE_data/src
diff options
context:
space:
mode:
authorZandra Hird <[email protected]>2015-05-08 13:31:57 +0200
committerZandra Hird <[email protected]>2015-05-08 13:31:57 +0200
commitb9c2f04a51ee20e49b74dcdb160ca102a217edc5 (patch)
tree42228dd3233c30246bbc8fec363fd4f8ed485c3f /lib/dialyzer/test/small_SUITE_data/src
parent6b15e5e613c4688c5fbd7bc409a011971b699dc3 (diff)
parent00ff3b3776a62402e7977fd9172a926ad62ea449 (diff)
downloadotp-b9c2f04a51ee20e49b74dcdb160ca102a217edc5.tar.gz
otp-b9c2f04a51ee20e49b74dcdb160ca102a217edc5.tar.bz2
otp-b9c2f04a51ee20e49b74dcdb160ca102a217edc5.zip
Merge branch 'aronisstav/dialyzer-inv-mult'
* aronisstav/dialyzer-inv-mult: Fix a bug related to constraints generated for erlang:'*'/2 OTP-12725
Diffstat (limited to 'lib/dialyzer/test/small_SUITE_data/src')
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/inv_mult.erl15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/src/inv_mult.erl b/lib/dialyzer/test/small_SUITE_data/src/inv_mult.erl
new file mode 100644
index 0000000000..3413556813
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/src/inv_mult.erl
@@ -0,0 +1,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).