Dialyzer success type question
Wed Dec 15 15:29:16 CET 2010
Apologizes for quoting Kostis out of context,
On 12/6/10 8:56 , Kostis Sagonas wrote:
> Yes. As you see, dialyzer is not only smart but is also quite sensitive!
> If it ever feels neglected for too long, it has a very effective way of
> letting you know that you should never do that again ;-)
Not only that, it seems to suffer from mood swings between releases :-)
We offer up our code to Dialyzers scrutiny several times a day, and are
happy to do so. However when upgrading to R14B01 we ran into a bit of
problem with Dialyzers concept of success typing, as it seems to have
changed in R14B01?
Here is a minimal example of my problem, with two modules, first:
io:format("doing something...\n", ),
m2:fail(true, "Failed: ...\n", ).
and the other module:
fail(HaltP, Fmt, Args) ->
io:format(standard_error, Fmt, Args),
case HaltP of
Now, if I kindly ask dialyzer to analyze this I get:
m1.erl:3: Function do_something/0 has no local return
Which I expect, and I can turn it off if I wish by using -Wno_return (or
spec:ing that I know it doesn't return). However, I also get:
m1.erl:5: The call m2:fail('true',"Failed: ...\n",) will never
return since it differs in the 1st argument from the success typing
arguments: ('false',atom() | binary() | [any()],[any()])
Which is a problem, since there is no way for me to turn it off, also it
seems a bit inconsistent, if I change the case clause in fail/3 to:
case HaltP of
I do not get the above message (even though I guess dialyzer could
figure out that the "success typing" is "anything *but* true:-). It
doesn't seem to help to spec me out of this, even if I spec my intent by:
-spec fail(boolean(), string(), [any()]) -> 'ok' | no_return().
I still get the complaint (as long as I have 'false' in the case clause).
Any hints on how I can appease dialyzer and let it know that I don't
expect my fail function to return when I tell it not to?
Sebastian Strollo / seb@REDACTED
Tail-f Systems / www.tail-f.com
More information about the erlang-questions