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

Failed to parse warning #234

Closed
blatyo opened this issue Aug 21, 2018 · 10 comments
Closed

Failed to parse warning #234

blatyo opened this issue Aug 21, 2018 · 10 comments

Comments

@blatyo
Copy link

blatyo commented Aug 21, 2018

Using: 1.0.0-rc.3

Failed to parse warning:
[{:"(", 1}, {:atom_part, 1, 'A'}, {:atom_part, 1, 't'}, {:atom_part, 1, 'o'}, {:atom_part, 1, 'm'}, {:",", 1}, {:atom_part, 1, 'E'}, {:atom_part, 1, 'n'}, {:atom_part, 1, 'c'}, {:atom_part, 1, 'o'}, {:atom_part, 1, 'd'}, {:atom_part, 1, 'i'}, {:atom_part, 1, 'n'}, {:atom_part, 1, 'g'}, {:")", 1}, {:->, 1}, {:atom_part, 1, 'b'}, {:atom_part, 1, 'i'}, {:atom_part, 1, 'n'}, {:atom_part, 1, 'a'}, {:atom_part, 1, 'r'}, {:atom_part, 1, 'y'}, {:"(", 1}, {:")", 1}, {:atom_part, 1, 'w'}, {:atom_part, 1, 'h'}, {:atom_part, 1, 'e'}, {:atom_part, 1, 'n'}, {:atom_part, 1, 'A'}, {:atom_part, 1, 't'}, {:atom_part, 1, 'o'}, {:atom_part, 1, 'm'}, {:::, 1}, {:atom_part, 1, 'a'}, {:atom_part, 1, 't'}, {:atom_part, 1, 'o'}, {:atom_part, 1, 'm'}, {:"(", 1}, {:")", 1}, {:",", 1}, {:atom_part, 1, 'E'}, {:atom_part, 1, 'n'}, {:atom_part, 1, 'c'}, {:atom_part, 1, 'o'}, {:atom_part, 1, 'd'}, {:atom_part, 1, 'i'}, {:atom_part, 1, 'n'}, {:atom_part, 1, ...}, {:::, ...}, {...}, ...]


Legacy warning:
lib/conduit/broker/outgoing_scope.ex:73: The call erlang:atom_to_binary(binary(),'utf8') breaks the contract (Atom,Encoding) -> binary() when Atom :: atom(), Encoding :: 'latin1' | 'unicode' | 'utf8'
@asummers
Copy link
Collaborator

asummers commented Aug 21, 2018

Huh interesting. I totally don't have any concept of whens yet in Erlex (underlying parsing lib) and no one's reported one of these yet. Will work on getting that added. Thanks for the report.

@asummers
Copy link
Collaborator

Can you paste the surrounding function head and spec, if you don't mind @blatyo

@blatyo
Copy link
Author

blatyo commented Aug 21, 2018

@blatyo
Copy link
Author

blatyo commented Aug 21, 2018

I believe a simplified case that will generate this is (untested):

defmodule X do
  def x do
    Atom.to_string("not an atom")
  end
end

@blatyo
Copy link
Author

blatyo commented Aug 21, 2018

The issue is that this is incorrectly typed as string instead of atom: https://github.com/conduitframework/conduit/blob/dialyxir-issue/lib/conduit/broker/publish_route.ex#L10

@asummers
Copy link
Collaborator

Thanks. Might not get to it for a few days, but this is on my radar. If you're feeling adventurous, PRs are certainly welcome =)

@asummers
Copy link
Collaborator

asummers commented Aug 23, 2018

I have a tentative fix for it on asummers/erlex#8 but I don't have time this evening to test on your project -- can you give that a spin and let me know if it looks okay? I should get some time to run on your project tomorrow, if not.

@blatyo
Copy link
Author

blatyo commented Aug 23, 2018

Doesn't seem to work. I ran with erlex overriden to your branch:

https://github.com/conduitframework/conduit/blob/dialyxir-issue/mix.exs#L61

Failed to parse warning:
[{:"(", 1}, {:atom_part, 1, 'A'}, {:atom_part, 1, 't'}, {:atom_part, 1, 'o'}, {:atom_part, 1, 'm'}, {:",", 1}, {:atom_part, 1, 'E'}, {:atom_part, 1, 'n'}, {:atom_part, 1, 'c'}, {:atom_part, 1, 'o'}, {:atom_part, 1, 'd'}, {:atom_part, 1, 'i'}, {:atom_part, 1, 'n'}, {:atom_part, 1, 'g'}, {:")", 1}, {:->, 1}, {:atom_part, 1, 'b'}, {:atom_part, 1, 'i'}, {:atom_part, 1, 'n'}, {:atom_part, 1, 'a'}, {:atom_part, 1, 'r'}, {:atom_part, 1, 'y'}, {:"(", 1}, {:")", 1}, {:atom_part, 1, 'w'}, {:atom_part, 1, 'h'}, {:atom_part, 1, 'e'}, {:atom_part, 1, 'n'}, {:atom_part, 1, 'A'}, {:atom_part, 1, 't'}, {:atom_part, 1, 'o'}, {:atom_part, 1, 'm'}, {:::, 1}, {:atom_part, 1, 'a'}, {:atom_part, 1, 't'}, {:atom_part, 1, 'o'}, {:atom_part, 1, 'm'}, {:"(", 1}, {:")", 1}, {:",", 1}, {:atom_part, 1, 'E'}, {:atom_part, 1, 'n'}, {:atom_part, 1, 'c'}, {:atom_part, 1, 'o'}, {:atom_part, 1, 'd'}, {:atom_part, 1, 'i'}, {:atom_part, 1, 'n'}, {:atom_part, 1, ...}, {:::, ...}, {...}, ...]


Legacy warning:
lib/conduit/broker/outgoing_scope.ex:73: The call erlang:atom_to_binary(binary(),'utf8') breaks the contract (Atom,Encoding) -> binary() when Atom :: atom(), Encoding :: 'latin1' | 'unicode' | 'utf8'

@asummers
Copy link
Collaborator

Hmm yeah that should be working. I'll see if I can figure out why it's still upset.

@asummers
Copy link
Collaborator

@blatyo Interesting. Seems to be working, but overriding it in that manner wasn't seeming to take it? Unsure why. I had to pull down a copy of Dialyxir and override it in there. Will merge the Erlex PR and make the associated bump here.

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

No branches or pull requests

2 participants