diff options
Diffstat (limited to 'lib/compiler/src')
| -rw-r--r-- | lib/compiler/src/beam_call_types.erl | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/compiler/src/beam_call_types.erl b/lib/compiler/src/beam_call_types.erl index 8b9cb836fd..697566cecb 100644 --- a/lib/compiler/src/beam_call_types.erl +++ b/lib/compiler/src/beam_call_types.erl @@ -365,12 +365,19 @@ types(erlang, is_boolean, [Type]) -> types(erlang, is_float, [Type]) -> sub_unsafe_type_test(Type, #t_float{}); types(erlang, is_function, [Type, #t_integer{elements={Arity,Arity}}]) - when Arity >= 0, Arity =< ?MAX_FUNC_ARGS -> + when is_integer(Arity) -> RetType = - case meet(Type, #t_fun{arity=Arity}) of - Type -> #t_atom{elements=[true]}; - none -> #t_atom{elements=[false]}; - _ -> beam_types:make_boolean() + if + Arity < 0 -> + none; + 0 =< Arity, Arity =< ?MAX_FUNC_ARGS -> + case meet(Type, #t_fun{arity=Arity}) of + Type -> #t_atom{elements=[true]}; + none -> #t_atom{elements=[false]}; + _ -> beam_types:make_boolean() + end; + Arity > ?MAX_FUNC_ARGS -> + #t_atom{elements=[false]} end, sub_unsafe(RetType, [any, any]); types(erlang, is_function, [Type]) -> |
