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 when struct is to match a string. #450

Open
eksperimental opened this issue Jan 21, 2022 · 0 comments
Open

Failed to parse warning when struct is to match a string. #450

eksperimental opened this issue Jan 21, 2022 · 0 comments

Comments

@eksperimental
Copy link
Contributor

Precheck

  • Take a look at the open issues and be sure that your issue is not already covered.
  • Be sure your versions of Dialyxir and Erlex are up to date.

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
    Erlang/OTP 24 [erts-12.1.2]
    Elixir 1.13.1 (compiled with Erlang/OTP 24)

  • Which version of Dialyxir are you using? (cat mix.lock | grep dialyxir): 1.1.0

Current behavior

Please file a bug in https://github.com/jeremyjh/dialyxir/issues with this message.

Failed to parse warning:
[{:<, 1}, {:<, 1}, {:int, 1, 211228306992}, {:":", 1}, {:int, 1, 40}, {:>, 1}, {:>, 1}]


Legacy warning:
lib/beam_meta/util.ex:65: The pattern <<211228306992:40>> can never match the type #{'__struct__':='Elixir.Version', _=>_}

the simplified code is

  def to_version_requirement(%Version{} = version) do
    case version do
      "1.0.0" -> "1.0.0"
      _ -> "-0"
    end
  end

the offending lines is "1.0.0" -> "1.0.0" because version is a struct, so i can never match that string.

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

1 participant