diff options
author | Björn Gustavsson <[email protected]> | 2015-02-02 13:01:10 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-02-03 07:34:17 +0100 |
commit | 94b36c7c2534f92e1d1ce768fb63d9012bb0c630 (patch) | |
tree | 824fc247e6049575a2a0324a1a985d2432d57bde /lib/compiler/src | |
parent | d9ed708bb5d22cf61029eac0a23b9d3dc94a5146 (diff) | |
download | otp-94b36c7c2534f92e1d1ce768fb63d9012bb0c630.tar.gz otp-94b36c7c2534f92e1d1ce768fb63d9012bb0c630.tar.bz2 otp-94b36c7c2534f92e1d1ce768fb63d9012bb0c630.zip |
Be more careful about map patterns when evalutating element/2
We must not convert map patterns to map expressions.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/sys_core_fold.erl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl index 2158c29576..f4f5c3f361 100644 --- a/lib/compiler/src/sys_core_fold.erl +++ b/lib/compiler/src/sys_core_fold.erl @@ -1338,9 +1338,12 @@ eval_element(Call, #c_literal{val=Pos}, #c_var{name=V}, Types) {ok,#c_tuple{es=Elements}} -> if 1 =< Pos, Pos =< length(Elements) -> - case lists:nth(Pos, Elements) of - #c_alias{var=Alias} -> Alias; - Res -> Res + El = lists:nth(Pos, Elements), + try + pat_to_expr(El) + catch + throw:impossible -> + Call end; true -> eval_failure(Call, badarg) |