dashbitco / nimble_parsec

A simple and fast library for text-based parser combinators

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Additional Dialyzer warnings

kipcole9 opened this issue · comments

José, I've tried to work out these issues so I could send a PR but my dialyzer-fu is poor and my understanding of the architecture of nimble_parsec is primitive at best..

Environment

  • Elixir 1.8.1
  • OTP 21
  • nimble_parsec from git master

Errors

I have omitted what I believe are duplicated errors to leave as simple a case as possible. The source links directly to where the error is indicated.

lib/cldr/language_tag/rfc5646_grammar.ex:13:no_return
Function langtag/0 has no local return.

Source

________________________________________________________________________________
lib/cldr/language_tag/rfc5646_grammar.ex:59:call_without_opaque
The call NimbleParsec.concat('Elixir.NimbleParsec':t(),nonempty_maybe_improper_list()) does not have an opaque term of type 'Elixir.NimbleParsec':t() in 2nd.

Source

________________________________________________________________________________
lib/cldr/language_tag/rfc5646_grammar.ex:82:call_with_opaque
The call NimbleParsec.label('Elixir.NimbleParsec':t(),<<_:320>>) contains an opaque term in 1st argument when terms of different types are expected in these positions}.

Source

________________________________________________________________________________

lib/cldr/language_tag/rfc5646_grammar.ex:146:call_without_opaque
The call NimbleParsec.unwrap_and_tag(nonempty_maybe_improper_list(),'type') does not have an opaque term of type 'Elixir.NimbleParsec':t() in 1st.

Source

________________________________________________________________________________
lib/cldr/language_tag/rfc5646_grammar.ex:271:call_without_opaque
The call NimbleParsec.choice([nonempty_maybe_improper_list(),...]) does not have a term of type ['Elixir.NimbleParsec':t(),...] (with opaque subterms) in 1st.

Source

________________________________________________________________________________

Hi @kipcole9, can you please provide a repo and a command that reproduces those so i can take a look at the,?

And after a loooong time I'm back on this. I've added this pull request that corrects the @spec for tag/3 and label/3 but I am still seeing dialyzer errors on calls to label/3 that I can't identify. I think this is the root of several other errors I'm seeing.

https://github.com/elixir-cldr/cldr is a repo that exhibits the issue with a single dialyzer error (I've commented out all other calls to label/3 to make this clearer). It's configured to use my fork of nimble_parsec which has the fixes for tag/3 and label/3 specs.

Running mix dialzyer should show a single error:

lib/cldr/language_tag/rfc5646_grammar.ex:21:call_with_opaque
The call NimbleParsec.label('Elixir.NimbleParsec':t(),<<97,32,118,97,108,105,100,32,66,67,80,45,52,55,32,108,97,110,103,117,97,103,101,32,116,97,103>>) contains an opaque term in 1st argument when terms of different types are expected in these positions}.

Apologies for keeping this issue open and inactive so long.

No problem at all @kipcole9! If you can figure out the warnings, please let us know and we will gladly accept PRs. :)

The last PR I sent fixing two @specs resolves the outstanding dialyzer warnings (now that I've added @specs to my combinators.

Closing this issue. And hoping you might consider pushing master as a new release to hex?

With pleasure, 0.5.1 is out. Thank you for the contributions @kipcole9, very appreciated!

Actually, v0.5.1 is not out, there seems to be an issue with Hex. I will publish it as soon as it is fixed.