diff options
author | Björn Gustavsson <[email protected]> | 2018-09-12 11:41:43 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-09-12 14:19:04 +0200 |
commit | d96778ad4631d649fe64716e07e4f3a2ba9c681d (patch) | |
tree | ed5553ab818068cf8511e0e9e98eabeb26c23557 /lib/compiler/src | |
parent | 0442b6a4587c0961febe3c6044d94d2ce7f8f469 (diff) | |
download | otp-d96778ad4631d649fe64716e07e4f3a2ba9c681d.tar.gz otp-d96778ad4631d649fe64716e07e4f3a2ba9c681d.tar.bz2 otp-d96778ad4631d649fe64716e07e4f3a2ba9c681d.zip |
beam_validator: Handle types for unary '-' or '+'
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/beam_validator.erl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl index 953aced66e..d5833875ff 100644 --- a/lib/compiler/src/beam_validator.erl +++ b/lib/compiler/src/beam_validator.erl @@ -1919,6 +1919,12 @@ is_bif_safe(self, 0) -> true; is_bif_safe(node, 0) -> true; is_bif_safe(_, _) -> false. +arith_type([A], Vst) -> + %% Unary '+' or '-'. + case get_term_type(A, Vst) of + {float,_} -> {float,[]}; + _ -> number + end; arith_type([A,B], Vst) -> case {get_term_type(A, Vst),get_term_type(B, Vst)} of {{float,_},_} -> {float,[]}; |