diff options
author | Björn Gustavsson <[email protected]> | 2019-01-21 07:04:46 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2019-01-21 12:57:54 +0100 |
commit | 990976907841dd3122c82992ba9965ee313e988c (patch) | |
tree | 8ccc4c8a103c6ed5a206912ff2eb3df707ccf674 /erts/emulator/test | |
parent | a11ddd5862fa06a3242e548fbd232a4c294ca7a8 (diff) | |
download | otp-990976907841dd3122c82992ba9965ee313e988c.tar.gz otp-990976907841dd3122c82992ba9965ee313e988c.tar.bz2 otp-990976907841dd3122c82992ba9965ee313e988c.zip |
Optimize the is_function/2 guard test
The is_function2 instruction is executed surprisingly
frequently when running dialyzer or the compiler. It
cannot hurt to optimize it a little.
Diffstat (limited to 'erts/emulator/test')
-rw-r--r-- | erts/emulator/test/fun_SUITE.erl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/erts/emulator/test/fun_SUITE.erl b/erts/emulator/test/fun_SUITE.erl index f8a879182e..4042b58ff2 100644 --- a/erts/emulator/test/fun_SUITE.erl +++ b/erts/emulator/test/fun_SUITE.erl @@ -710,6 +710,16 @@ t_is_function2(Config) when is_list(Config) -> bad_arity({}), bad_arity({a,b}), bad_arity(self()), + + %% Bad arity argument in guard test. + Fun = fun erlang:abs/1, + ok = if + is_function(Fun, -1) -> error; + is_function(Fun, 256) -> error; + is_function(Fun, a) -> error; + is_function(Fun, Fun) -> error; + true -> ok + end, ok. bad_arity(A) -> |