[erlang-questions] A few type-related 18.0 questions

Tuncer Ayaz tuncer.ayaz@REDACTED
Mon Jul 20 20:13:59 CEST 2015


On Mon, Jul 20, 2015 at 11:19 AM, Olivier BOUDEVILLE wrote:
>
> Hello Tuncer,
>
> > 1. M1 exists as a file
> >
> > 2. M1 call M2:gimme_data/1, say in M1:do_stuff/3
> >
> > 3. M2 only exists at runtime without a corresponding file
> >
> > 4. The warning is about a call to M2:gimme_data/1 which is
> >    unknown because M2 doesn't exist (yet).
> >
> > Assuming I got this right, you would add
> >
> > -dialyzer({no_missing_calls, do_stuff/3})
> >
> > in M1.erl, to avoid the warning.
>
> Indeed, you got it right, however, unless I made clumsy mistakes, in
> M1.erl (using your example functions), no combination of:
>
>          -dialyzer( { no_missing_calls, do_stuff/3 } ).
>
> and/or
>
>          -dialyzer( { nowarn_function, do_stuff/3 } ).
>
> prevents Dialyzer from telling that functions like M2:gimme_data/1
> are unknown.

I haven't checked the implementation, but maybe with M2.beam
non-existent, {no_missing_calls, do_stuff/3} makes no difference. That
would explain why it works for rebar_utils and not M1.

> I was thinking that functions specified in the -dialyzer attribute
> are the callee ones, not the caller ones (that's why I wanted to see
> whether we could specify a module for them, if they were not
> M1-local).

{no_missing_calls, do_stuff/3} tells Dialyzer to not raise a missing
function warning for any call within do_stuff/3.

> Anyway, not a big problem. Maybe in the future separate suppression
> files (listing the warnings to be suppressed regardless of the call
> site) will be supported (supposing it is not supported yet).
>
> Thanks for your time!



More information about the erlang-questions mailing list