From 982d6706df475dc28535d0fe7922573c618bbc36 Mon Sep 17 00:00:00 2001 From: Stavros Aronis Date: Fri, 16 Mar 2012 18:33:05 +0100 Subject: Fix bug related with infinitely looping functions Depending of the ordering of the functions during dataflow, a function with an infinite loop might be identified as one that always crashes. This is fixed now, by allowing restoration of the infinitely-looping status. --- .../test/small_SUITE_data/src/maybe_servers.erl | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lib/dialyzer/test/small_SUITE_data/src/maybe_servers.erl (limited to 'lib/dialyzer/test') diff --git a/lib/dialyzer/test/small_SUITE_data/src/maybe_servers.erl b/lib/dialyzer/test/small_SUITE_data/src/maybe_servers.erl new file mode 100644 index 0000000000..237f43b1a6 --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/src/maybe_servers.erl @@ -0,0 +1,31 @@ +-module(maybe_servers). + +-export([maybe_server/2, mirror_maybe_server/2]). + +maybe_server(O, I) -> + case O of + no -> + maybe_loop(fun(_) -> fin end, I); + yes -> + maybe_loop(fun(X) -> {ok, X} end, I) + end. + +maybe_loop(F, X)-> + case F(X) of + {ok, Y} -> maybe_loop(F, Y); + fin -> exit(n) + end. + +mirror_maybe_loop(F, X)-> + case F(X) of + {ok, Y} -> mirror_maybe_loop(F, Y); + fin -> exit(n) + end. + +mirror_maybe_server(O, I) -> + case O of + no -> + mirror_maybe_loop(fun(_) -> fin end, I); + yes -> + mirror_maybe_loop(fun(X) -> {ok, X} end, I) + end. -- cgit v1.2.3