aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2012-10-03 15:20:09 +0200
committerHenrik Nord <[email protected]>2012-10-03 15:20:09 +0200
commit197b7b99b9e7e70046d51fa90b5922a1b22ee8cc (patch)
tree3b11293ba7a0ab2229b5b3b9da072be041f29c0f /lib/dialyzer/test
parent54e7cc9086908a0e5642caa6ac3680557acc5a67 (diff)
parentab151d0adebc31fbb74adffa69e4524f69dc8b62 (diff)
downloadotp-197b7b99b9e7e70046d51fa90b5922a1b22ee8cc.tar.gz
otp-197b7b99b9e7e70046d51fa90b5922a1b22ee8cc.tar.bz2
otp-197b7b99b9e7e70046d51fa90b5922a1b22ee8cc.zip
Merge branch 'maint'
Diffstat (limited to 'lib/dialyzer/test')
-rw-r--r--lib/dialyzer/test/race_SUITE_data/results/ets_insert_args102
-rw-r--r--lib/dialyzer/test/race_SUITE_data/src/ets_insert_args10.erl19
-rw-r--r--lib/dialyzer/test/small_SUITE_data/results/contracts_with_subtypes2
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/remote_tuple_set.erl8
4 files changed, 30 insertions, 1 deletions
diff --git a/lib/dialyzer/test/race_SUITE_data/results/ets_insert_args10 b/lib/dialyzer/test/race_SUITE_data/results/ets_insert_args10
new file mode 100644
index 0000000000..c3c9b12bdd
--- /dev/null
+++ b/lib/dialyzer/test/race_SUITE_data/results/ets_insert_args10
@@ -0,0 +1,2 @@
+
+ets_insert_args10.erl:9: The call ets:insert(T::'foo',[{'counter',number()},...]) might have an unintended effect due to a possible race condition caused by its combination with the ets:lookup(T::'foo','counter') call in ets_insert_args10.erl on line 8
diff --git a/lib/dialyzer/test/race_SUITE_data/src/ets_insert_args10.erl b/lib/dialyzer/test/race_SUITE_data/src/ets_insert_args10.erl
new file mode 100644
index 0000000000..c897a34af0
--- /dev/null
+++ b/lib/dialyzer/test/race_SUITE_data/src/ets_insert_args10.erl
@@ -0,0 +1,19 @@
+%% This tests the presence of possible races due to an ets:lookup/ets:insert
+%% combination. It takes into account the argument types of the calls.
+
+-module(ets_insert_args10).
+-export([start/0]).
+
+start() ->
+ F = fun(T) -> [{_, N}] = ets:lookup(T, counter),
+ ets:insert(T, [{counter, N+1}])
+ end,
+ io:format("Created ~w\n", [ets:new(foo, [named_table, public])]),
+ A = {counter, 0},
+ B = [],
+ ets:insert(foo, [A|B]),
+ io:format("Inserted ~w\n", [{counter, 0}]),
+ F(foo),
+ io:format("Update complete\n", []),
+ ObjectList = ets:lookup(foo, counter),
+ io:format("Counter: ~w\n", [ObjectList]).
diff --git a/lib/dialyzer/test/small_SUITE_data/results/contracts_with_subtypes b/lib/dialyzer/test/small_SUITE_data/results/contracts_with_subtypes
index 8dc0361b0d..4850f3ff0c 100644
--- a/lib/dialyzer/test/small_SUITE_data/results/contracts_with_subtypes
+++ b/lib/dialyzer/test/small_SUITE_data/results/contracts_with_subtypes
@@ -6,7 +6,7 @@ contracts_with_subtypes.erl:109: The call contracts_with_subtypes:rec_arg({'b',{
contracts_with_subtypes.erl:110: The call contracts_with_subtypes:rec_arg({'a',{'b',{'a','b'}}}) breaks the contract (Arg) -> 'ok' when is_subtype(Arg,{'a',A} | {'b',B}), is_subtype(A,'a' | {'b',B}), is_subtype(B,'b' | {'a',A})
contracts_with_subtypes.erl:111: The call contracts_with_subtypes:rec_arg({'b',{'a',{'b','a'}}}) breaks the contract (Arg) -> 'ok' when is_subtype(Arg,{'a',A} | {'b',B}), is_subtype(A,'a' | {'b',B}), is_subtype(B,'b' | {'a',A})
contracts_with_subtypes.erl:142: The pattern 1 can never match the type binary() | string()
-contracts_with_subtypes.erl:145: The pattern 'alpha' can never match the type {'ok',X} | {'ok',X,binary() | string()}
+contracts_with_subtypes.erl:145: The pattern 'alpha' can never match the type {'ok',_} | {'ok',_,binary() | string()}
contracts_with_subtypes.erl:147: The pattern 42 can never match the type {'ok',_} | {'ok',_,binary() | string()}
contracts_with_subtypes.erl:163: The pattern 'alpha' can never match the type {'ok',X}
contracts_with_subtypes.erl:165: The pattern 42 can never match the type {'ok',X}
diff --git a/lib/dialyzer/test/small_SUITE_data/src/remote_tuple_set.erl b/lib/dialyzer/test/small_SUITE_data/src/remote_tuple_set.erl
new file mode 100644
index 0000000000..6c440ed04c
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/src/remote_tuple_set.erl
@@ -0,0 +1,8 @@
+-module(remote_tuple_set).
+
+-export([parse_cidr/0]).
+
+-spec parse_cidr() -> {inet:address_family(),1,2} | {error}.
+
+parse_cidr() ->
+ {inet,1,2}.