[erlang-questions] Unlike behavior in -spec and type importing

Chris King <>
Sun Aug 11 17:27:19 CEST 2013


Hi Ivan,

On Sun, 11 Aug 2013 11:14:16 -0400, Ivan Carmenates García  
<> wrote:

>
>
>> I check the source of application module to see if the start_type()  
>> type was exported and it >is not.
>
> And my module compiles well, and even I changed to StartType ::  
> unknown_module: unknown_type>() type and it still compiles,
>
> It seems that there are no type checking outside of the module.

Are you using Dialyzer to check types?  The Erlang compiler itself does  
not perform typechecking.  You can run Dialyzer (included with OTP) on  
your source code like this:

$ dialyzer --src <source code directory>

or, if you compile your code with debugging enabled, you can run it like  
this:

$ dialyzer <object file directory>

In addition to inferring types, Dialyzer will check that code adheres to  
-spec declarations, and it will warn about unexported types.

Note that you have to run Dialyzer on *all* your modules, as it only sees  
the modules you tell it about, and those whose specifications have been  
explicitly stored in its "PLT" database (by default erts, kernel, and  
stdlib).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130811/ca614133/attachment.html>


More information about the erlang-questions mailing list