aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/ms_transform_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stdlib/test/ms_transform_SUITE.erl')
-rw-r--r--lib/stdlib/test/ms_transform_SUITE.erl40
1 files changed, 26 insertions, 14 deletions
diff --git a/lib/stdlib/test/ms_transform_SUITE.erl b/lib/stdlib/test/ms_transform_SUITE.erl
index a17307b07b..1577caa80f 100644
--- a/lib/stdlib/test/ms_transform_SUITE.erl
+++ b/lib/stdlib/test/ms_transform_SUITE.erl
@@ -40,6 +40,7 @@
-export([action_function/1]).
-export([warnings/1]).
-export([no_warnings/1]).
+-export([eep37/1]).
-export([init_per_testcase/2, end_per_testcase/2]).
init_per_testcase(_Func, Config) ->
@@ -57,7 +58,7 @@ all() ->
record_index, multipass, bitsyntax, record_defaults,
andalso_orelse, float_1_function, action_function,
warnings, no_warnings, top_match, old_guards, autoimported,
- semicolon].
+ semicolon, eep37].
groups() ->
[].
@@ -90,21 +91,23 @@ warnings(Config) when is_list(Config) ->
" end)">>,
?line [{_,[{_,ms_transform,{?WARN_NUMBER_SHADOW,'A'}}]}] =
compile_ww(Prog),
- Prog2 = <<"C=5, "
- "ets:fun2ms(fun({A,B} = C) "
- " when is_integer(A) and (A+5 > B) -> "
- " {A andalso B,C} "
- " end)">>,
- ?line [{_,[{_,ms_transform,{?WARN_NUMBER_SHADOW,'C'}}]}] =
+ Prog2 = <<"C = 5,
+ ets:fun2ms(fun ({A,B} =
+ C) when is_integer(A) and (A+5 > B) ->
+ {A andalso B,C}
+ end)">>,
+ [{_,[{3,ms_transform,{?WARN_NUMBER_SHADOW,'C'}}]}] =
compile_ww(Prog2),
Rec3 = <<"-record(a,{a,b,c,d=foppa}).">>,
- Prog3 = <<"A=3,C=5, "
- "ets:fun2ms(fun(#a{a = A, b = B} = C) "
- " when is_integer(A) and (A+5 > B) -> "
- " {A andalso B,C} "
- " end)">>,
- ?line [{_,[{_,ms_transform,{?WARN_NUMBER_SHADOW,'A'}},
- {_,ms_transform,{?WARN_NUMBER_SHADOW,'C'}}]}] =
+ Prog3 = <<"A = 3,
+ C = 5,
+ ets:fun2ms(fun (C
+ = #a{a = A, b = B})
+ when is_integer(A) and (A+5 > B) ->
+ {A andalso B,C}
+ end)">>,
+ [{_,[{3,ms_transform,{?WARN_NUMBER_SHADOW,'C'}},
+ {4,ms_transform,{?WARN_NUMBER_SHADOW,'A'}}]}] =
compile_ww(Rec3,Prog3),
Rec4 = <<"-record(a,{a,b,c,d=foppa}).">>,
Prog4 = <<"A=3,C=5, "
@@ -806,6 +809,14 @@ action_function(Config) when is_list(Config) ->
ok.
+eep37(Config) when is_list(Config) ->
+ setup(Config),
+ [{'$1',[],['$1']}] =
+ compile_and_run(<<"F = fun _Ms() ->\n"
+ " ets:fun2ms(fun (X) -> X end)\n"
+ " end,\n"
+ "F()">>).
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -858,6 +869,7 @@ compile_ww(Records,Expr) ->
"-include_lib(\"stdlib/include/ms_transform.hrl\").\n",
"-export([tmp/0]).\n",
Records/binary,"\n",
+ "-file(?FILE, 0). ",
"tmp() ->\n",
Expr/binary,".\n">>,
FN=temp_name(),