Record field matching problem under debugger

Dan Gudmundsson dgud@REDACTED
Sun Jan 2 22:17:23 CET 2022


Hmm, I "improved" the record handling recently in the debugger,
can you make a github issue on this so I don't forget about it.
/Dan

On Sun, Jan 2, 2022 at 10:00 PM Wojtek Surowka <wojteksurowka@REDACTED> wrote:

> I have noticed that some functionality does not work for me if I run my
> Erlang system under debugger. After investigation I constructed a
> minimal example to see the problem. Is it expected or is it a bug? I
> use Erlang/OTP 24.
>
> The problem can be seen with the following module:
>
> -module(testrec).
> -export([test/0]).
>
> -record(test, {field1, field2}).
>
> func1(Field) when Field =:= #test.field1 -> ok.
> func2(#test.field1) -> ok.
>
> test() ->
>     io:format("1: ~p~n", [func1(#test.field1)]),
>     io:format("2: ~p~n", [func2(#test.field1)]).
>
> If I compile this and run test(), I am getting two ok's printed as
> expected. But if I start debugger first with debugger:start() and
> select the module for debugging with ii(testrec) the function func2
> does not work:
>
> 6> testrec:test().
> 1: ok
> ** exception error: no function clause matching testrec:func2(2)
> (testrec.erl, line 7)
>      in function  testrec:test/0 (testrec.erl, line 11)
>
> Thanks,
> Wojtek
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20220102/462b911f/attachment.htm>


More information about the erlang-questions mailing list