diff options
author | Björn Gustavsson <[email protected]> | 2012-01-18 14:52:01 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-01-18 14:52:01 +0100 |
commit | 629b82f49b68f7189f5bd93f72c5ddc3eb9a7460 (patch) | |
tree | 8a0398be0ca526253d1b0cfaee36e8f40331c2ae /lib/stdlib/src | |
parent | 9a32176dac422146982192fb1be95d4a246efeef (diff) | |
parent | e3b658cbc9b5838ed2596cc30790c26bfa90953f (diff) | |
download | otp-629b82f49b68f7189f5bd93f72c5ddc3eb9a7460.tar.gz otp-629b82f49b68f7189f5bd93f72c5ddc3eb9a7460.tar.bz2 otp-629b82f49b68f7189f5bd93f72c5ddc3eb9a7460.zip |
Merge branch 'bjorn/compiler/bif-call-bug/OTP-9866' into maint
* bjorn/compiler/bif-call-bug/OTP-9866:
erl_lint: Consistently reject local calls from guards
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/erl_lint.erl | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl index e5adb84932..2f29954dc9 100644 --- a/lib/stdlib/src/erl_lint.erl +++ b/lib/stdlib/src/erl_lint.erl @@ -1804,12 +1804,19 @@ guard_test(G, Vt, St0) -> %% Specially handle record type test here. guard_test2({call,Line,{atom,Lr,record},[E,A]}, Vt, St0) -> gexpr({call,Line,{atom,Lr,is_record},[E,A]}, Vt, St0); -guard_test2({call,_Line,{atom,_La,F},As}=G, Vt, St0) -> +guard_test2({call,Line,{atom,_La,F},As}=G, Vt, St0) -> {Asvt,St1} = gexpr_list(As, Vt, St0), %Always check this. A = length(As), case erl_internal:type_test(F, A) of - true when F =/= is_record -> {Asvt,St1}; - _ -> gexpr(G, Vt, St0) + true when F =/= is_record -> + case no_guard_bif_clash(St1, {F,A}) of + false -> + {Asvt,add_error(Line, {illegal_guard_local_call,{F,A}}, St1)}; + true -> + {Asvt,St1} + end; + _ -> + gexpr(G, Vt, St0) end; guard_test2(G, Vt, St) -> %% Everything else is a guard expression. |