[erlang-questions] Dialyzer bugs help

Anthony Ramine n.oxyde@REDACTED
Thu Jan 2 23:03:28 CET 2014


Well, even if the function is unused, such a warning seems quite wrong or at least very confusing.

-- 
Anthony Ramine

Le 2 janv. 2014 à 22:49, Sean Cribbs <seancribbs@REDACTED> a écrit :

> Thanks Anthony!
> 
> Kostis replied to me privately and we found what you did -- unused functions get none() type parameters because there's no type to infer. Not sure if this is a Dialyzer bug (the function had a spec!), or just a fact-of-life.  This basically raised the fact I had been hacking around tracking which combinators were used/unused in the generated parser by injecting a -compile({nowarn_unused_function, [...]}) attribute into the generated code. Shame on me! I've rectified the issue for now using macros.
> 
> The other errors are more trivial.
> 
> 
> On Thu, Jan 2, 2014 at 3:19 PM, Anthony Ramine <n.oxyde@REDACTED> wrote:
> Hello again Sean, hello Kostis,
> 
> There is something in Dialyzer that makes it say weird stuff about unused unexported functions.
> 
> -module(t).
> 
> -compile({nowarn_unused_function,[p_assert/1]}).
> 
> -ifdef(EXPORT).
> -export([p_assert/1]).
> -endif.
> 
> p_assert(P) ->
>     fun(Input,Index) ->
>         case P(Input,Index) of
>             {fail,_} = Failure -> Failure;
>             _ -> {[], Input, Index}
>         end
>     end.
> 
> If compiled with -DEXPORT, Dialyzer stays silent; if compiled without, Dialyzer yells.
> 
> Interestingly enough, it also unexpectedly yells if compiled with +export_all.
> 
> Regards,
> 
> --
> Anthony Ramine
> 
> Le 2 janv. 2014 à 22:09, Anthony Ramine <n.oxyde@REDACTED> a écrit :
> 
> > Still fighting these two.
> 
> 




More information about the erlang-questions mailing list