diff options
author | Stavros Aronis <[email protected]> | 2012-03-16 18:33:05 +0100 |
---|---|---|
committer | Stavros Aronis <[email protected]> | 2012-03-26 23:46:27 +0200 |
commit | 982d6706df475dc28535d0fe7922573c618bbc36 (patch) | |
tree | 05450ca5452905ffe2be08b2bc937e21e146b483 /lib/dialyzer/test | |
parent | 154b98e876256310b3832334695094487da6ea3a (diff) | |
download | otp-982d6706df475dc28535d0fe7922573c618bbc36.tar.gz otp-982d6706df475dc28535d0fe7922573c618bbc36.tar.bz2 otp-982d6706df475dc28535d0fe7922573c618bbc36.zip |
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.
Diffstat (limited to 'lib/dialyzer/test')
-rw-r--r-- | lib/dialyzer/test/small_SUITE_data/src/maybe_servers.erl | 31 |
1 files changed, 31 insertions, 0 deletions
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. |