File 3545-features-Use-real-features-support.patch of Package erlang
From 0a114f4d06e8c7634722c27788cbf9c13d8fd857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cons=20T=20=C3=85hs?= <cons@erlang.org>
Date: Mon, 14 Mar 2022 16:15:38 +0100
Subject: [PATCH 5/7] [features] Use real features support
---
lib/stdlib/src/shell.erl | 8 ++------
lib/syntax_tools/src/epp_dodger.erl | 13 +++++--------
lib/tools/test/cover_SUITE.erl | 7 +++----
3 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/lib/stdlib/src/shell.erl b/lib/stdlib/src/shell.erl
index cc147848e3..7de78758b0 100644
--- a/lib/stdlib/src/shell.erl
+++ b/lib/stdlib/src/shell.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2021. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2022. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -273,11 +273,7 @@ server_loop(N0, Eval_0, Bs00, RT, Ds00, History0, Results0) ->
end.
get_command(Prompt, Eval, Bs, RT, Ds) ->
- ResWordFun =
- fun('maybe') -> true;
- ('else') -> true;
- (Other) -> erl_scan:reserved_word(Other)
- end,
+ ResWordFun = fun erl_scan:reserved_word/1,
Parse =
fun() ->
exit(
diff --git a/lib/syntax_tools/src/epp_dodger.erl b/lib/syntax_tools/src/epp_dodger.erl
index edf092bfcd..2e0694c2cf 100644
--- a/lib/syntax_tools/src/epp_dodger.erl
+++ b/lib/syntax_tools/src/epp_dodger.erl
@@ -431,14 +431,11 @@ parse_form(Dev, L0, Parser, Options) ->
NoFail = proplists:get_bool(no_fail, Options),
Opt = #opt{clever = proplists:get_bool(clever, Options)},
- %% FIXME: This should not be hard-coded. Either all keywords from
- %% all features should be retrieved here, or there should be an option
- %% to passes in either the keywords or the feature names.
- ResWordFun =
- fun('maybe') -> true;
- ('else') -> true;
- (Other) -> erl_scan:reserved_word(Other)
- end,
+ %% This as the *potential* to read options for enabling/disabling
+ %% features for the parsing of the file.
+ {ok, {_Ftrs, ResWordFun}} =
+ erl_features:keyword_fun(Options,
+ fun erl_scan:f_reserved_word/1),
case io:scan_erl_form(Dev, "", L0, [{reserved_word_fun,ResWordFun}]) of
{ok, Ts, L1} ->
diff --git a/lib/tools/test/cover_SUITE.erl b/lib/tools/test/cover_SUITE.erl
index a3dfa7a068..b02b3df0b6 100644
--- a/lib/tools/test/cover_SUITE.erl
+++ b/lib/tools/test/cover_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2001-2021. All Rights Reserved.
+%% Copyright Ericsson AB 2001-2022. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -1881,8 +1881,8 @@ eep49(Config) ->
File = "t.erl",
Test = <<"-module(t).
+ -feature(enable,maybe_expr).
-export([t/0]).
- -compile([{enable_feature,'maybe'}]).
t() ->
t1(), %6
@@ -1920,8 +1920,7 @@ eep49(Config) ->
end.
">>,
ok = file:write_file(File, Test),
- %% FIXME: Remove `enable_feature` option here when it can be recognized inside a module.
- {ok, t} = cover:compile(File, [{enable_feature,maybe_expr}]),
+ {ok, t} = cover:compile(File),
ok = t:t(),
{ok,[{{t,6},1}, {{t,8},1}, {{t,9},1}, {{t,10},1}, {{t,12},1},
{{t,13},1}, {{t,14},1}, {{t,16},1},
--
2.34.1