[erlang-questions] A few type-related 18.0 questions
Tuncer Ayaz
tuncer.ayaz@REDACTED
Sat Jul 18 11:40:40 CEST 2015
On Fri, Jul 17, 2015 at 6:01 PM, Olivier BOUDEVILLE wrote:
> Hello Tuncer,
>
> [...]
>
> > Are you saying that
> >
> > (1) because the module doesn't exist as a .beam file Dialyzer
> > doesn't know of its existence
>
> In this particular case, the generated module exists neither as a
> source file (.erl) nor as a compiled one (.beam), as it exists only
> at runtime and in-memory - so I do not think Dialyzer has any chance
> to be aware of it and of its actual content (exports)?
The official API operates only on files, so I can't find anything
either. Your use case isn't out of the ordinary and very valid, and
maybe you can save the file, but it can unnecessarily complicate
your project's structure or build process.
> 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).
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.
More information about the erlang-questions
mailing list