[erlang-bugs] binary:part/3

Kostis Sagonas <>
Sun Feb 17 11:59:12 CET 2013


On 02/16/2013 06:25 AM, Michael Truog wrote:
> There is a problem with the binary:part type spec used by dialyzer (the function is a BIF), such that it thinks the Length is pos_integer() instead of integer().  A similar problem exists within the documentation here (with the Length type):
> http://www.erlang.org/doc/man/binary.html#part-3

First of all, the documentation you are pointing out specifies that the 
third argument is "Len = integer() >= 0" so Len should be declared as 
non_neg_integer(), not integer().

Second, and more important, this has been corrected in R16A/R16B:

   https://github.com/erlang/otp/blob/master/lib/stdlib/src/binary.erl#L186

If you want a correction for a previous Erlang/OTP release, change the 
corresponding entry in file lib/hipe/cerl/erl_bif_types.erl

Kostis


More information about the erlang-bugs mailing list