[erlang-bugs] Variable incorrectly unbound when bound and used in binary match
Björn Gustavsson
bgustavsson@REDACTED
Mon Mar 14 17:03:19 CET 2011
On Fri, Mar 11, 2011 at 12:16 AM, Bernard Duggan <bernie@REDACTED> wrote:
> Reposting this (with slight modifications) that was posed in the questions
> list. It seemed presumptuous to go straight to the bugs list, but the
> consensus seems to be that that's what this is:
>
> So I've just run into an interesting little bit of behaviour that
> doesn't seem quite right. In the following code:
> -----------------------------------------
> -module(casetest).
>
> -export([test/0]).
>
> test() ->
> match(<<1, 2, 3, 4, 5, 6, 7, 8>>).
>
> match(<<A:1/binary, B:8/integer, _C:B/binary, _Rest/binary>>) ->
> case A of
> B -> wrong;
> _ -> ok
> end.
[...]
Thanks for reporting this bug.
It is indeed a bug in the handling of
variables in binary matching.
It is too late to fix the bug in R14B02,
so we will fix it in R14B03.
--
Björn Gustavsson, Erlang/OTP, Ericsson AB
More information about the erlang-bugs
mailing list