Skip to content

Commit

Permalink
When a function has no spec, assume function type with any() args and…
Browse files Browse the repository at this point in the history
… return type

Even when a function does not have a spec, we still know that it is a function
and that is of certain arity.

This is probably related to making the infer flag default in josefs#573, as without
infer, we always assumed any() when there wasn't a spec for something.
  • Loading branch information
xxdavid committed Oct 17, 2024
1 parent 6210517 commit 13d6893
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/typechecker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -5798,7 +5798,7 @@ create_fenv(Specs, Funs) ->
% case it will mean that if there is a spec, then that will take precedence
% over the default type any().
maps:from_list(
[ {{Name, NArgs}, [type(any)]}
[ {{Name, NArgs}, absform:normalize_function_type_list([type_fun(NArgs)])}
|| {function,_, Name, NArgs, _Clauses} <- Funs
] ++
[ {{Name, NArgs}, absform:normalize_function_type_list(Types)}
Expand Down

0 comments on commit 13d6893

Please sign in to comment.