This one is tricky. I’ve been working with dializer and typer on coverize and hit the following warning from dialyzer:
coverize.erl:13: Function run/2 has no local return
Seems like it would have something to do with the return types. Right? Certainly seems like it would be. After searching, experimenting and trying everything I could think of with setting the return, luck bestowed upon me the following link: http://zerthurd.blogspot.com/2009/05/dialyzer-warning-no-local-return.html .
After about 3 seconds of staring at the following code, it hit me.
-spec(run/2 :: (list(string()), atom()) -> ok). run(SourceDirs,TestSuiteModule) -> CompileOptions = [ debug_info, { i, "./include" }, { outdir, "./ebin" }], run(SourceDirs,CompileOptions,TestSuiteModule,"./coverage"). -spec(run/4 :: (list(string()), list(atom()|tuple()), atom(), string()) -> ok).
Look closely at the values in CompileOptions. Tuples -yes, then AHA! – debug_info is an atom().
The correct spec should have atom() as an alternative in the second parameter.
Here’s the corrected version
-spec(run/4 :: (list(string()), list(atom()|tuple()), atom(), string()) -> ok).
Dialyzer is now happy!
What a huge waste of time to figure that one out. Dialyzer needs better messages for this
Posted by mgmullis