[erlang-questions] Strange matching behavior

block.rxckin.beats@REDACTED block.rxckin.beats@REDACTED
Thu Sep 5 10:06:21 CEST 2019


Hi Lukas

Updating 10.4.4 works fine for me thanks.
Can I see the bug ticket for this behavior ?

Jxck


2019年9月5日(木) 16:59 Lukas Larsson <lukas@REDACTED>:

> Hello,
>
> On Thu, Sep 5, 2019 at 9:39 AM block.rxckin.beats@REDACTED <
> block.rxckin.beats@REDACTED> wrote:
>
>> I found strange behavior, see code below.
>>
>> why last match doesn't works ?
>>
>
> It is a bug in the compiler in OTP-22 that has been fixed. If you upgrade
> to the latest OTP-22 patched version it works as it should.
>
> Lukas
>
>
>>
>>
>> ```main.erl
>> #!/usr/bin/env escript
>> -module(main).
>>
>> -mode(compile).
>> -compile(export_all).
>>
>> xy() ->
>>     #{ 160506610  => x, 3960650446 => y }.
>>
>> x() ->
>>     #{ 160506610  => x }.
>>
>> y() ->
>>     #{ 3960650446 => y }.
>>
>> xy2() ->
>>     #{ 888888888  => x, 9999999999 => y }.
>>
>> main(_) ->
>>     #{ 160506610  := x } = xy(), % ok
>>     #{ 3960650446 := y } = xy(), % ok
>>
>>     #{ 160506610  := x } = x(), % ok
>>     #{ 3960650446 := y } = y(), % ok
>>
>>
>>     #{ 888888888  := x,
>>        9999999999 := y
>>      } = xy2(), % ok
>>
>>
>>     #{ 160506610  := x,
>>        3960650446 := y
>>      } = xy(), % no match of right hand side value, WHY ??
>>
>>     ok.
>> ```
>>
>> Erlang: Erlang/OTP 22 [erts-10.4] [source] [64-bit] [smp:8:8] [ds:8:8:10]
>> [async-threads:1] [hipe]
>> OS: Ubuntu 19.04 disco
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190905/679aad09/attachment.htm>


More information about the erlang-questions mailing list