diff options
author | Björn Gustavsson <[email protected]> | 2014-02-11 08:31:37 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2014-02-11 10:09:46 +0100 |
commit | c89ada7517420ce9065840ea857a0009418ce2af (patch) | |
tree | dab65ace0b321ee7bf20514d5bddd38db7f59cd5 /lib/public_key/include | |
parent | 198d0eb1459413d5d8d6521d339e4a93a5b76cfd (diff) | |
download | otp-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/public_key/include')
0 files changed, 0 insertions, 0 deletions