[erlang-questions] erlang 21 binary matching bug in functin definition

Michał Muskała michal@REDACTED
Fri Aug 3 18:45:38 CEST 2018


On 3 Aug 2018, 18:32 +0200, Brujo Benavides <elbrujohalcon@REDACTED>, wrote:
> Well, that’s not happening here…
>

I think you simplified the function too much, so it doesn't trigger the bug in the compiler anymore. I can reproduce the bug with a somewhat simpler code:


-module(a).

-export([err/2]).

err(_, <<Length, Data/binary>>) ->
    case {Length, Data} of
        {0, _} -> Data;
        {4, <<Rest/binary>>} -> Rest
    end.

Calling a:err(1, <<0>>) returns <<0>>. That's on 21.0.2

Michał.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180803/3fa8ed6c/attachment.htm>


More information about the erlang-questions mailing list