Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Record field matching problem under debugger #5571

@wojteksurowka

Description

@wojteksurowka

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.

Metadata

Metadata

Assignees

Labels

bugIssue is reported as a bugteam:PSAssigned to OTP team PS

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions