Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record field matching problem under debugger #5571

Closed
wojteksurowka opened this issue Jan 2, 2022 · 0 comments
Closed

Record field matching problem under debugger #5571

wojteksurowka opened this issue Jan 2, 2022 · 0 comments
Assignees
Labels
bug Issue is reported as a bug team:PS Assigned to OTP team PS

Comments

@wojteksurowka
Copy link

Function clause matching does not work under debugger if the syntax #record.field is used as function parameter.

To reproduce use 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 it is run under debugger, test() call ends with

1: ok
** exception error: no function clause matching testrec:func2(2)
(testrec.erl, line 7)
     in function  testrec:test/0 (testrec.erl, line 11)

Without debugger it correctly prints two ok's. This is observed in Erlang/OTP 24.

@wojteksurowka wojteksurowka added the bug Issue is reported as a bug label Jan 2, 2022
@dgud dgud self-assigned this Jan 2, 2022
@dgud dgud added the team:PS Assigned to OTP team PS label Jan 2, 2022
@dgud dgud closed this as completed in bea7ad7 Jan 26, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:PS Assigned to OTP team PS
Projects
None yet
Development

No branches or pull requests

2 participants