Skip to content

Commit 1780574

Browse files
committed
Fix dialyzer spec errors in cxy_ctl and ets_buffer; don't dialyze _SUITE
1 parent 192b2e4 commit 1780574

4 files changed

Lines changed: 19 additions & 19 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ TEST_ERLC_OPTS := -I include -I test/epocxy $(ERLC_OPTS)
1010
CT_OPTS := -cover test/epocxy.coverspec
1111
CT_SUITES = ets_buffer cxy_ctl cxy_cache
1212

13-
DIALYZER_OPTS := -I include test/epocxy -Werror_handling -Wrace_conditions -Wunmatched_returns
13+
DIALYZER_OPTS := -I include -Werror_handling -Wrace_conditions -Wunmatched_returns
1414

1515
include erlang.mk

src/cxy_ctl.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
-type dict_value() :: any().
4141
-type dict_entry() :: {dict_key(), dict_value()}.
4242
-type dict_prop() :: dict_key() | dict_entry().
43-
-type dict_props() :: [dict_prop()].
43+
-type dict_props() :: [dict_prop()] | none | all_keys.
4444
-type dict_prop_vals() :: [{?VALID_DICT_VALUE_MARKER, dict_entry()}].
4545

4646
-spec make_process_dictionary_default_value(Key, Value)
@@ -401,7 +401,7 @@ get_calling_dictionary_values([], Props) -> Props.
401401

402402

403403
-spec execute_wrapper(atom(), atom(), list(), atom(), integer(), false | erlang:timestamp(), spawn | inline, dict_prop_vals())
404-
-> true | no_return().
404+
-> any() | no_return().
405405

406406
%% If Start is 'false', we don't want to record elapsed time history...
407407
execute_wrapper(Mod, Fun, Args, Task_Type, _Max_History, false, Spawn_Or_Inline, Dict_Prop_Pairs) ->

src/ets_buffer.erl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ buffer_data(Name, Loc, Time, Data) ->
263263
| {buffer_name(), fifo | lifo}]) -> ets_buffer.
264264
-spec create(buffer_name(), fifo | lifo) -> buffer_name().
265265
-spec create(buffer_name(), ring, buffer_size()) -> buffer_name().
266-
-spec clear(buffer_name()) -> boolean().
266+
-spec clear(buffer_name()) -> boolean() | buffer_error().
267267
-spec delete(buffer_name()) -> boolean().
268268

269269
-spec write(buffer_name(), buffer_data()) -> non_neg_integer() | true | buffer_error().
@@ -419,7 +419,7 @@ clear_high_water(Buffer_Name) when is_atom(Buffer_Name) ->
419419
-spec list_dedicated(buffer_name()) -> proplists:proplist().
420420
-spec create_dedicated(buffer_name(), fifo | lifo) -> buffer_name().
421421
-spec create_dedicated(buffer_name(), ring, buffer_size()) -> buffer_name().
422-
-spec clear_dedicated(buffer_name()) -> boolean().
422+
-spec clear_dedicated(buffer_name()) -> boolean() | buffer_error().
423423
-spec delete_dedicated(buffer_name()) -> boolean().
424424

425425
-spec write_dedicated(buffer_name(), any()) -> non_neg_integer() | true | buffer_error().
@@ -429,10 +429,10 @@ clear_high_water(Buffer_Name) when is_atom(Buffer_Name) ->
429429
-spec read_timestamped_dedicated(buffer_name()) -> [buffer_data_timestamped()] | buffer_error().
430430
-spec read_timestamped_dedicated(buffer_name(), pos_integer()) -> [buffer_data_timestamped()] | buffer_error().
431431
-spec read_all_timestamped_dedicated(buffer_name()) -> [buffer_data_timestamped()] | buffer_error().
432-
-spec history_dedicated(buffer_name()) -> [buffer_data()].
433-
-spec history_dedicated(buffer_name(), pos_integer()) -> [buffer_data()].
434-
-spec history_timestamped_dedicated(buffer_name()) -> [buffer_data()].
435-
-spec history_timestamped_dedicated(buffer_name(), pos_integer()) -> [buffer_data()].
432+
-spec history_dedicated(buffer_name()) -> [buffer_data()] | buffer_error().
433+
-spec history_dedicated(buffer_name(), pos_integer()) -> [buffer_data()] | buffer_error().
434+
-spec history_timestamped_dedicated(buffer_name()) -> [buffer_data()] | buffer_error().
435+
-spec history_timestamped_dedicated(buffer_name(), pos_integer()) -> [buffer_data()] | buffer_error().
436436
-spec num_entries_dedicated(buffer_name()) -> non_neg_integer() | buffer_error().
437437
-spec capacity_dedicated(buffer_name()) -> pos_integer() | unlimited | buffer_error().
438438
-spec clear_high_water_dedicated(buffer_name()) -> true | buffer_error().

test/epocxy/cxy_ctl_SUITE.erl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ check_maybe_execute_task(_Config) ->
152152
true = ?TM:init(Limits),
153153
Ets_Table = ets:new(check_maybe_execute_task, [public, named_table]),
154154

155-
try
155+
_ = try
156156
%% Over max should refuse to run...
157157
{max_pids, 0} = ?TM:maybe_execute_task(Overmax_Type, ets, insert_new, [Ets_Table, {joe, 5}]),
158158
erlang:yield(),
@@ -228,7 +228,7 @@ check_maybe_execute_pid_link(_Config) ->
228228

229229
%% When inline, update our process dictionary...
230230
Old_Joe = erase(joe),
231-
try
231+
_ = try
232232
{max_pids, 0} = ?TM:maybe_execute_pid_link(Overmax_Type, erlang, put, [joe, 5]),
233233
erlang:yield(),
234234
undefined = get(joe),
@@ -245,7 +245,7 @@ check_maybe_execute_pid_link(_Config) ->
245245
%% When spawned, it affects a new process dictionary, not ours.
246246
Self = self(),
247247
Old_Joe = erase(joe),
248-
try
248+
_ = try
249249
undefined = get(joe),
250250
New_Pid = ?TM:maybe_execute_pid_link(Spawn_Type, ?MODULE, put_pdict, [joe, 5]),
251251
false = (New_Pid =:= Self),
@@ -274,7 +274,7 @@ check_execute_pid_monitor(_Config) ->
274274

275275
%% When inline, update our process dictionary...
276276
Old_Joe = erase(joe),
277-
try
277+
_ = try
278278
{inline, undefined} = ?TM:execute_pid_monitor(Inline_Type, erlang, put, [joe, 5]),
279279
5 = get(joe),
280280
{inline, 5} = ?TM:execute_pid_monitor(Inline_Type, erlang, put, [joe, 7]),
@@ -285,7 +285,7 @@ check_execute_pid_monitor(_Config) ->
285285
%% When spawned, it affects a new process dictionary, not ours.
286286
Self = self(),
287287
Old_Joe = erase(joe),
288-
try
288+
_ = try
289289
undefined = get(joe),
290290
{New_Pid, _Monitor_Ref} = ?TM:execute_pid_monitor(Spawn_Type, ?MODULE, put_pdict, [joe, 5]),
291291
false = (New_Pid =:= self()),
@@ -309,7 +309,7 @@ check_maybe_execute_pid_monitor(_Config) ->
309309

310310
%% When inline, update our process dictionary...
311311
Old_Joe = erase(joe),
312-
try
312+
_ = try
313313
{max_pids, 0} = ?TM:maybe_execute_pid_monitor(Overmax_Type, erlang, put, [joe, 5]),
314314
erlang:yield(),
315315
undefined = get(joe),
@@ -326,7 +326,7 @@ check_maybe_execute_pid_monitor(_Config) ->
326326
%% When spawned, it affects a new process dictionary, not ours.
327327
Self = self(),
328328
Old_Joe = erase(joe),
329-
try
329+
_ = try
330330
undefined = get(joe),
331331
{New_Pid, _Monitor_Ref} = ?TM:maybe_execute_pid_monitor(Spawn_Type, ?MODULE, put_pdict, [joe, 5]),
332332
false = (New_Pid =:= Self),
@@ -386,10 +386,10 @@ get_pdict() ->
386386

387387
filter_pdict() -> [{K, V} || {{cxy_ctl, K}, V} <- get()].
388388

389-
-spec fetch_ages() -> proplists:proplist().
389+
-spec fetch_ages() -> pdict_timeout | {get_dict, pid(), proplists:proplist()}.
390390
fetch_ages() -> get_pdict().
391391

392-
-spec fetch_ets_ages(any()) -> proplists:proplist().
392+
-spec fetch_ets_ages(atom() | ets:tid()) -> ok.
393393
fetch_ets_ages(Ets_Table) ->
394394
Vals = [{K, V} || {{cxy_ctl, K}, V} <- get()],
395395
ets:insert(Ets_Table, {results, Vals}),
@@ -407,7 +407,7 @@ check_copying_dict(_Config) ->
407407
put({cxy_ctl, sam}, 7),
408408
Stable_Pre_Call_Dict = filter_pdict(),
409409

410-
try
410+
_ = try
411411
Self = self(),
412412
Ets_Table = ets:new(execute_task, [public, named_table]),
413413
Joe = ?TM:make_process_dictionary_default_value({cxy_ctl, joe}, 8),

0 commit comments

Comments
 (0)