Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix specs introduced with Mod:module_info/1,2 support #498

Merged
merged 1 commit into from
Dec 17, 2022

Conversation

erszcz
Copy link
Collaborator

@erszcz erszcz commented Dec 17, 2022

This brings self-check warnings back to 39 lines.

@erszcz erszcz merged commit a151fa9 into josefs:master Dec 17, 2022
@erszcz erszcz deleted the module-info-spec-fixes branch December 17, 2022 18:03
@@ -5112,7 +5112,7 @@ record_field_types(Fields) ->
end, Fields).

% Helper returning the type of module_info/0 and module_info/1 functions
-spec get_module_info_type(arity()) -> fun_ty().
-spec get_module_info_type(arity()) -> type() | [type()].
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use an two-clause spec (0) -> type(); (1) -> [type()] here?

Copy link
Collaborator

@zuiderkwast zuiderkwast Dec 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, what happens if some code contains a call to module_info/N where N > 1? Do we crash?

@xxdavid
Copy link
Collaborator

xxdavid commented Dec 19, 2022

Ooops, thanks for fixing it. I think the specs were right in an initial stage, but I then rewritten the implementation and forgot to change the specs. This is a good example of a situation where Gradualizer comes handy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants