diff options
author | Henrik Nord <[email protected]> | 2014-02-24 16:13:26 +0100 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2014-02-24 16:13:26 +0100 |
commit | ca693a05bda78d701ff8b47d851505098c79c077 (patch) | |
tree | 44249090aa591fe01e586359457d51d348d2aa65 /lib/stdlib/src/erl_eval.erl | |
parent | c38217f781b7a0d24edd58b124bd2c7accbfe434 (diff) | |
parent | 2c73f41fc16fbbbbfc0fea1ee0bbd5e6038e6a54 (diff) | |
download | otp-ca693a05bda78d701ff8b47d851505098c79c077.tar.gz otp-ca693a05bda78d701ff8b47d851505098c79c077.tar.bz2 otp-ca693a05bda78d701ff8b47d851505098c79c077.zip |
Merge branch 'josevalim/jv-eval-guards/OTP-11747'
* josevalim/jv-eval-guards/OTP-11747:
Fix erl_eval bug when erlang:'=='/2 is used in guards
Diffstat (limited to 'lib/stdlib/src/erl_eval.erl')
-rw-r--r-- | lib/stdlib/src/erl_eval.erl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/stdlib/src/erl_eval.erl b/lib/stdlib/src/erl_eval.erl index 63e7be4b74..3a4108e297 100644 --- a/lib/stdlib/src/erl_eval.erl +++ b/lib/stdlib/src/erl_eval.erl @@ -1006,12 +1006,16 @@ guard0([], _Bs, _Lf, _Ef) -> true. guard_test({call,L,{atom,Ln,F},As0}, Bs0, Lf, Ef) -> TT = type_test(F), G = {call,L,{atom,Ln,TT},As0}, - try {value,true,_} = expr(G, Bs0, Lf, Ef, none) - catch error:_ -> {value,false,Bs0} end; -guard_test({call,L,{remote,_Lr,{atom,_Lm,erlang},{atom,_Lf,_F}=T},As0}, + expr_guard_test(G, Bs0, Lf, Ef); +guard_test({call,L,{remote,Lr,{atom,Lm,erlang},{atom,Lf,F}},As0}, Bs0, Lf, Ef) -> - guard_test({call,L,T,As0}, Bs0, Lf, Ef); + TT = type_test(F), + G = {call,L,{remote,Lr,{atom,Lm,erlang},{atom,Lf,TT}},As0}, + expr_guard_test(G, Bs0, Lf, Ef); guard_test(G, Bs0, Lf, Ef) -> + expr_guard_test(G, Bs0, Lf, Ef). + +expr_guard_test(G, Bs0, Lf, Ef) -> try {value,true,_} = expr(G, Bs0, Lf, Ef, none) catch error:_ -> {value,false,Bs0} end. |