Skip to content

Commit 14610cb

Browse files
committed
Merge pull request #4115 from alco/alco/__info__-spec
Update the spec for the generated __info__/1 function to please Dialyzer
2 parents 5968df9 + 1703066 commit 14610cb

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

lib/elixir/src/elixir_module.erl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,18 +431,28 @@ add_info_function(Line, File, Module, All, Def, Defmacro) ->
431431
true ->
432432
elixir_errors:form_error([{line, Line}], File, ?MODULE, {internal_function_overridden, Pair});
433433
false ->
434+
AllowedArgs =
435+
lists:map(fun(Atom) -> {atom, Line, Atom} end,
436+
[attributes, compile, exports, functions, macros, md5, module, native_addresses]),
434437
Spec =
435438
{attribute, Line, spec, {Pair,
436439
[{type, Line, 'fun', [
437440
{type, Line, product, [
438-
{type, Line, atom, []}
441+
{type, Line, union, AllowedArgs}
439442
]},
440443
{type, Line, union, [
441444
{type, Line, atom, []},
442445
{type, Line, list, [
443-
{type, Line, tuple, [
444-
{type, Line, atom, []},
445-
{type, Line, any, []}
446+
{type, Line, union, [
447+
{type, Line, tuple, [
448+
{type, Line, atom, []},
449+
{type, Line, any, []}
450+
]},
451+
{type, Line, tuple, [
452+
{type, Line, atom, []},
453+
{type, Line, byte, []},
454+
{type, Line, integer, []}
455+
]}
446456
]}
447457
]}
448458
]}

0 commit comments

Comments
 (0)