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

Tuncer Ayaz tuncer.ayaz@REDACTED
Fri Jul 17 17:35:19 CEST 2015


On Thu, Jul 16, 2015 at 3:28 PM, Olivier BOUDEVILLE wrote:
> Hello Tuncer,
>
> tuncer.ayaz@REDACTED a écrit sur 26/06/2015 23:42:18 :
>
> [...]
> > > Using 18.0, is there a way of specifying to Dialyzer that
> > > warnings about calls to non-existing functions should be
> > > suppressed by telling that from outside of the module that is
> > > supposed to define these functions?
> >
> > Yes, Hans Bolinder was kind enough to add it on short notice
> > during the 18.0 cycle.
> >
> > We use it in rebar, which has to work on anything from R13B03 to
> > 18.0.
> > https://github.com/rebar/rebar/blob/6cc18c931c/src/rebar_utils.erl#L75:
> >
> > -dialyzer({no_missing_calls, escript_foldl/3}).
> >
> > This tells Dialyzer to ignore calls to unknown functions when
> > analyzing escript_foldl/3.
> >
> > Does this work for you?
>
> Thanks for your reply and sorry for my late message.
>
> The suppression I was mentioning regarded a call from a plain module
> M1 to another module M2 that is generated at runtime
> (compile:form/2) and then loaded (code:load_binary/3): Dialyzer then
> sees in M1 an actual call to a module M2 that it cannot find (no
> source nor BEAM file, for obvious reasons).

Are you saying that

(1) because the module doesn't exist as a .beam file Dialyzer doesn't
know of its existence

(2) and there's no way to make the ephemeral/volatile module known to
Dialyzer as part of the analysis call

?

> In this case I do not think we can tell Dialyzer to suppress this
> warning (since the -dialyzer attribute seems to be meant to be used
> in the sources *of the module itself*, i.e. it would have here to be
> specified in the sourceless M2).
>
> This is not a big issue (and these are edges cases indeed), but it
> would be interesting if we could define 'global' suppressions, or
> that would apply to a set of modules (similarly, Dialyzer would not
> be able to see that conditional calls could be done based on the
> actual availability of the exported function - using module_info/1
> for that; Dialyzer would then detect a potential call to a
> non-existing function, it would be neat if we could specify that
> these warnings should be suppressed as we know that this cannot
> happen).



More information about the erlang-questions mailing list