dlialyzer a bit too sceptic?
Ulf Wiger (AL/EAB)
ulf.wiger@REDACTED
Tue Jun 20 09:35:11 CEST 2006
Dialyzer (R11B-0) gave me the following warning on some 'rdbms' code:
{rdbms_groups,'-do_add_members/2-fun-0-',2}: Call to function
{rdbms_props,do_write_property,2} with signature ((_,{{'acl',atom()} |
{'typedef',_} | {'attr',_,_} | 'access_module' | 'acl' | 'indexes' |
'read_filter' | 'rec_type' | 'references' | 'write_filter',_}) -> 'ok')
will fail since the arguments are of type
('schema',{{'group',_,'membership'},_})!
But the function rdbms_props:do_write_property/2 looks like this:
do_write_property(Tab, Prop) ->
mnesia_schema:do_write_table_property(Tab, Prop).
I.e. absolutely no restrictions on Prop. If one were to introduce one,
it would be something similar to that of
mnesia_schema:write_table_property/2 - namely that Prop is a tuple with
at least one element.
write_table_property(Tab, Prop) when tuple(Prop), size(Prop) >= 1 ->
schema_transaction(fun() -> do_write_table_property(Tab, Prop) end);
write_table_property(Tab, Prop) ->
{aborted, {bad_type, Tab, Prop}}.
do_write_table_property(Tab, Prop) ->
TidTs = get_tid_ts_and_lock(schema, write),
{_, _, Ts} = TidTs,
Store = Ts#tidstore.store,
case change_prop_in_existing_op(Tab, Prop, write_property, Store) of
true ->
...
%% we have merged the table prop into the create_table op
ok;
false ->
...,
insert_schema_ops(TidTs, make_write_table_properties(Tab,
[Prop]))
end.
It's not at all clear to me why Dialyzer thinks the call would fail.
BR,
Ulf W
More information about the erlang-questions
mailing list