Closed elbrujohalcon closed 3 years ago
Describe the bug If you use a macro as a record name in a module where there is also a record that has an unused field, Hank crashes.
To Reproduce Analyze this module…
-module(macros). %% There must be a paresable record -record(a_rec, {unused_field}). %% But also an "unparseable" one -record(?MODULE, {}).
Expected behavior A warning about unused_field being unused.
unused_field
rebar3 logs
{{badarg,{tree,macro, {attr,7,[],none}, {macro,{tree,variable,{attr,7,[],none},'MODULE'},none}}}, [{erl_syntax,concrete,1,[{file,"erl_syntax.erl"},{line,7330}]}, {unused_record_fields,'-find_record_definition/2-fun-0-',2, [{file,"/Users/fernandobenavides/Projects/NextRoll/rebar3_hank/src/rules/unused_record_fields.erl"}, {line,110}]}, {lists,search,2,[{file,"lists.erl"},{line,1412}]}, {unused_record_fields,result,4, [{file,"/Users/fernandobenavides/Projects/NextRoll/rebar3_hank/src/rules/unused_record_fields.erl"}, {line,88}]}, {unused_record_fields,'-do_analyze/2-lc$^4/1-2-',4, [{file,"/Users/fernandobenavides/Projects/NextRoll/rebar3_hank/src/rules/unused_record_fields.erl"}, {line,52}]}, {unused_record_fields,'-analyze/2-lc$^0/1-0-',1, [{file,"/Users/fernandobenavides/Projects/NextRoll/rebar3_hank/src/rules/unused_record_fields.erl"}, {line,19}]}, {hank,'-analyze/4-lc$^5/1-5-',3, [{file,"/Users/fernandobenavides/Projects/NextRoll/rebar3_hank/src/hank.erl"}, {line,26}]}, {hank,analyze,4, [{file,"/Users/fernandobenavides/Projects/NextRoll/rebar3_hank/src/hank.erl"}, {line,26}]}]}
Describe the bug If you use a macro as a record name in a module where there is also a record that has an unused field, Hank crashes.
To Reproduce Analyze this module…
Expected behavior A warning about
unused_field
being unused.rebar3 logs