Avoiding false Dialyzer warnings for NIFs

Kostis Sagonas kostis@REDACTED
Mon May 24 14:45:12 CEST 2010


Björn Gustavsson wrote:
> Thanks for the feedback.
> 
> 2010/5/24 Kostis Sagonas <kostis@REDACTED>:
> 
>> =========================================================================
>> type(erlang, nif_error, 1, _) ->
>>  t_unit();     % this BIF and the next one are stubs for NIFs and never
>> return
>> type(erlang, nif_error, 2, Xs) ->
>>  strict(arg_types(erlang, nif_error, 2), Xs, fun (_) -> t_unit() end);
>> =========================================================================
> 
> OK. I have incorporated your change and revised the commit message.
> 
> One question, though. Does this mean that you *must* write a type
> spec for functions that call erlang:nif_error/1,2?

No, there is no such obligation.  Things will work smoothly even without 
any specs.

Still, specs are recommended because they will give type information to 
code that uses these NIFs.

Kostis


More information about the erlang-patches mailing list