From 23a497af427493b94739761e4d4974e12bc67579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 9 Apr 2019 06:37:55 +0200 Subject: Issue an error for improper use of record_info/2 in a fun `record_info/2` is a pseudo-function that requires literal arguments known at compile time. Therefore, the following usage is illegal: f() -> fun record_info/2. However, `erl_lint` did not issue a compilation error for this usage, and the compiler would crash in a later pass. https://bugs.erlang.org/browse/ERL-907 --- lib/stdlib/test/erl_lint_SUITE.erl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/stdlib/test') diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl index 939cc1024c..fe98a3796d 100644 --- a/lib/stdlib/test/erl_lint_SUITE.erl +++ b/lib/stdlib/test/erl_lint_SUITE.erl @@ -3576,10 +3576,12 @@ basic_errors(Config) -> {illegal_record_info, <<"f1() -> record_info(42, record). - f2() -> record_info(shoe_size, record).">>, + f2() -> record_info(shoe_size, record). + f3() -> fun record_info/2.">>, [], {errors,[{1,erl_lint,illegal_record_info}, - {2,erl_lint,illegal_record_info}],[]}}, + {2,erl_lint,illegal_record_info}, + {3,erl_lint,illegal_record_info}],[]}}, {illegal_expr, <<"f() -> a:b.">>, -- cgit v1.2.3