aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/small_SUITE_data/src/rebar_no_return.erl
diff options
context:
space:
mode:
authorStavros Aronis <[email protected]>2011-03-20 23:43:53 +0200
committerStavros Aronis <[email protected]>2011-08-29 09:31:36 +0300
commit45537dc582a4fe44a3407e97acb0e1e391fdcd6d (patch)
treead8d3c87ff020889158a460a352c6cd15e64611f /lib/dialyzer/test/small_SUITE_data/src/rebar_no_return.erl
parente7f7a3052096286a3df0b6c2217a9fe3248be7f4 (diff)
downloadotp-45537dc582a4fe44a3407e97acb0e1e391fdcd6d.tar.gz
otp-45537dc582a4fe44a3407e97acb0e1e391fdcd6d.tar.bz2
otp-45537dc582a4fe44a3407e97acb0e1e391fdcd6d.zip
Suppress some warnings about generation of non-returning funs
No warnings are emitted for funs that are non-returning when the function that generates them has a contract that specifies that it will return such a non-returning fun. The actual bug, reported by Tuncer Ayaz and simplified by Maria Christakis is included in Dialyzer's tests.
Diffstat (limited to 'lib/dialyzer/test/small_SUITE_data/src/rebar_no_return.erl')
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/rebar_no_return.erl19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/src/rebar_no_return.erl b/lib/dialyzer/test/small_SUITE_data/src/rebar_no_return.erl
new file mode 100644
index 0000000000..d3b504ae04
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/src/rebar_no_return.erl
@@ -0,0 +1,19 @@
+-module(rebar_no_return).
+
+-export([t/0]).
+
+-spec t() -> no_return().
+t() ->
+ F = log_and_halt("baz"),
+ F("foo", 123).
+
+-spec log_and_halt(string()) -> fun((string(),integer()) -> no_return()).
+log_and_halt(Msg) ->
+ fun(_, _) ->
+ abort(Msg)
+ end.
+
+-spec abort(string()) -> no_return().
+abort(Msg) ->
+ io:format("~s~n", [Msg]),
+ halt(1).