diff options
author | Björn Gustavsson <[email protected]> | 2015-11-10 14:49:12 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-11-10 15:01:53 +0100 |
commit | 7929fd383a90e1fbc47b6d0625cd8d889794a755 (patch) | |
tree | a2d350b8495a70d0add16ceccf5c689c8153de26 | |
parent | 488862ddb45a8949efe5d71b7eb4a4a5e6406a07 (diff) | |
download | otp-7929fd383a90e1fbc47b6d0625cd8d889794a755.tar.gz otp-7929fd383a90e1fbc47b6d0625cd8d889794a755.tar.bz2 otp-7929fd383a90e1fbc47b6d0625cd8d889794a755.zip |
sys_pre_expand: Cover coerce_to_float/2
-rw-r--r-- | lib/compiler/src/sys_pre_expand.erl | 3 | ||||
-rw-r--r-- | lib/compiler/test/bs_match_SUITE.erl | 13 |
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/compiler/src/sys_pre_expand.erl b/lib/compiler/src/sys_pre_expand.erl index 150a453eec..7ab4e1845c 100644 --- a/lib/compiler/src/sys_pre_expand.erl +++ b/lib/compiler/src/sys_pre_expand.erl @@ -552,8 +552,7 @@ coerce_to_float({integer,L,I}=E, [float|_]) -> try {float,L,float(I)} catch - error:badarg -> E; - error:badarith -> E + error:badarg -> E end; coerce_to_float(E, _) -> E. diff --git a/lib/compiler/test/bs_match_SUITE.erl b/lib/compiler/test/bs_match_SUITE.erl index a19b152bc5..d8bef18a1a 100644 --- a/lib/compiler/test/bs_match_SUITE.erl +++ b/lib/compiler/test/bs_match_SUITE.erl @@ -116,9 +116,16 @@ fun_shadow_4(L) -> int_float(Config) when is_list(Config) -> %% OTP-5323 - ?line <<103133.0:64/float>> = <<103133:64/float>>, - ?line <<103133:64/float>> = <<103133:64/float>>, - ok. + <<103133.0:64/float>> = <<103133:64/float>>, + <<103133:64/float>> = <<103133:64/float>>, + + %% Coverage of error cases in sys_pre_expand:coerce_to_float/2. + case id(default) of + <<(1 bsl 1024):64/float>> -> + ?t:fail(); + default -> + ok + end. %% Stolen from erl_eval_SUITE and modified. %% OTP-5269. Bugs in the bit syntax. |