Skip to content

Commit f0c2835

Browse files
committed
erl_lint: Mark records used in record_info/2 as used
1 parent 5cf5f97 commit f0c2835

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

lib/stdlib/src/erl_lint.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5278,7 +5278,7 @@ check_record_info_call(_Anno,_Aa,[{atom,Ai,Info},{atom,_An,Name}], St) ->
52785278
true ->
52795279
case St#lint.records of
52805280
#{Name := {_,tuple,_}} ->
5281-
St;
5281+
used_record(Name, St);
52825282
#{} ->
52835283
add_error(Ai, native_record_illegal_record_info, St)
52845284
end;

lib/stdlib/test/erl_lint_SUITE.erl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5695,9 +5695,10 @@ illegal_zip_generator(Config) ->
56955695

56965696
ok.
56975697

5698-
%% GH-9694. Only record_info/2 should be checked for illegal_record_info
56995698
record_info_0(Config) ->
5700-
Ts = [{record_info_0,
5699+
Ts = [%% GH-9694. Only record_info/2 should be checked for
5700+
%% illegal_record_info
5701+
{record_info_0,
57015702
<<"-export([f/0]).
57025703
record_info() -> ok.
57035704
f() -> record_info().
@@ -5710,6 +5711,14 @@ record_info_0(Config) ->
57105711
g() -> record_info(ok).
57115712
">>,
57125713
[],
5714+
[]},
5715+
%% ERIERL-1345: record_info/2 should mark tuple records as used
5716+
{record_info_2,
5717+
<<"-export([h/0]).
5718+
-record(rec,{a,b,c}).
5719+
h() -> record_info(fields, rec).
5720+
">>,
5721+
[],
57135722
[]}
57145723
],
57155724
[] = run(Config, Ts),

0 commit comments

Comments
 (0)