aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/core_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-02-11 08:31:37 +0100
committerBjörn Gustavsson <[email protected]>2014-02-11 10:09:46 +0100
commitc89ada7517420ce9065840ea857a0009418ce2af (patch)
treedab65ace0b321ee7bf20514d5bddd38db7f59cd5 /lib/compiler/test/core_SUITE.erl
parent198d0eb1459413d5d8d6521d339e4a93a5b76cfd (diff)
downloadotp-c89ada7517420ce9065840ea857a0009418ce2af.tar.gz
otp-c89ada7517420ce9065840ea857a0009418ce2af.tar.bz2
otp-c89ada7517420ce9065840ea857a0009418ce2af.zip
Teach sys_core_fold:eval_case/2 to cope with handwritten Core Erlang
Starting in e12b7d5331c58b41db06cadfa4af75b78b62a2b1, sys_core_fold:eval_case/2 will crash on handwritten but legal Core Erlang programs such as: case let <Var> = Arg in {'x',Var} of {x,X} -> X end The problem is that the only clause *is* guaranteed to match, but cerl_clauses:match_list/2 does not understand that; all it can say is that the clause *may* match. In those circumstances, we will need to keep the case. Also make sure that we keep the case if the guard is something else than 'true'. That is not strictly necessary, because in a legal Core Erlang program the guard in the last clause in a case must always evaluate to 'true', so removing the guard test would still leave the program correct. Keeping the guard, however, will make it somewhat easier to debug an incorrect Core Erlang program. (The unsafe_case test case has guard test in the only clause in a case, so we don't need to write a new test case to test that.) Reported-by: Anthony Ramine
Diffstat (limited to 'lib/compiler/test/core_SUITE.erl')
-rw-r--r--lib/compiler/test/core_SUITE.erl5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/compiler/test/core_SUITE.erl b/lib/compiler/test/core_SUITE.erl
index 1a521c3591..aa222c48de 100644
--- a/lib/compiler/test/core_SUITE.erl
+++ b/lib/compiler/test/core_SUITE.erl
@@ -24,7 +24,7 @@
dehydrated_itracer/1,nested_tries/1,
seq_in_guard/1,make_effect_seq/1,eval_is_boolean/1,
unsafe_case/1,nomatch_shadow/1,reversed_annos/1,
- map_core_test/1]).
+ map_core_test/1,eval_case/1]).
-include_lib("test_server/include/test_server.hrl").
@@ -50,7 +50,7 @@ groups() ->
[{p,test_lib:parallel(),
[dehydrated_itracer,nested_tries,seq_in_guard,make_effect_seq,
eval_is_boolean,unsafe_case,nomatch_shadow,reversed_annos,
- map_core_test
+ map_core_test,eval_case
]}].
@@ -76,6 +76,7 @@ end_per_group(_GroupName, Config) ->
?comp(nomatch_shadow).
?comp(reversed_annos).
?comp(map_core_test).
+?comp(eval_case).
try_it(Mod, Conf) ->
Src = filename:join(?config(data_dir, Conf), atom_to_list(Mod)),