Avoiding false Dialyzer warnings for NIFs

Björn Gustavsson <>
Mon May 24 14:11:27 CEST 2010

Thanks for the feedback.

2010/5/24 Kostis Sagonas <>:

> =========================================================================
> 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?

> For your fix to be complete, I suggest you also add -specs for all crypto
> functions that are implemented as NIFs.  With this patch, these can be added
> directly to the crypto.erl file and dialyzer will handle them properly.

Yes, will do that in the next iteration (probably tomorrow).

The (updated) branch can be fetched like this:

git fetch git://github.com/bjorng/otp.git bg/nif_error

Björn Gustavsson, Erlang/OTP, Ericsson AB

More information about the erlang-patches mailing list