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

Type erl_anno:anno() should not be opaque #2609

Closed
wants to merge 1 commit into from

Conversation

josevalim
Copy link
Contributor

The docs
refer to the annotation simply as LINE, however, if we were
to add the lines manually and give it to erl_eval:expr/2,
Dialyzer will complain as erl_anno:anno() is listed as opaque.

This makes erl_anno:anno() as non-opaque, with the
location() as public type but the annotation() as private.

The [docs](http://erlang.org/doc/apps/erts/absform.html)
refer to the annotation simply as LINE, however, if we were
to add the lines manually and give it to erl_eval:expr/2,
Dialyzer will complain as erl_anno:anno() is listed as opaque.

This makes erl_anno:anno() as non-opaque, with the
location() as public type but the annotation() as private.
@kostis
Copy link
Contributor

kostis commented Apr 25, 2020

What exactly do you mean by

if we were to add the lines manually

Write just 42?

Why can't you write erl_anno:new(42) instead as e.g. PropEr does all over the place? (For example, search for ?anno in proper_typeserver.

Dialyzer is rarely an excuse to break programming abstractions.

@josevalim
Copy link
Contributor Author

I am aware. If LINE is no longer accepted, then the docs have to be updated and it needs to be listed as a breaking change. At the moment, the docs and specs are inconsistent.

@kostis
Copy link
Contributor

kostis commented Apr 25, 2020

Yes. IMO it's the docs that need to be updated -- they should have been when the erl_anno module was introduced (18.x ?)

@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Apr 26, 2020
@uabboli
Copy link
Contributor

uabboli commented Apr 27, 2020

I agree with Kostis. I'll write a ticket on updating the docs.

If you cannot find the cause of Dialyzer warnings and suspect erl_anno i involved, you can compile erl_anno with DEBUG. erl_anno will then only work with annotations that are lists.

@uabboli uabboli self-assigned this Apr 27, 2020
@josevalim
Copy link
Contributor Author

Thanks everyone! I will close to this then and make sure we are using erl_anno across the board.

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

Successfully merging this pull request may close these issues.

4 participants