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

Enable -Wunmatched_return in dialyzer #508

Merged
merged 1 commit into from
Jun 19, 2024
Merged

Conversation

jchristgit
Copy link
Collaborator

No description provided.

@jchristgit
Copy link
Collaborator Author

@BrandtHill There's a lot of voice-related warnings from Dialyzer here, where we are ignoring potential ok / error results.

Do you think we should ignore the results as we do presently or match against them?

lib/nostrum/shard/dispatch.ex:346:unmatched_return
The expression produces a value of type:

nil | :ok | {:error, <<_::248, _::size(32)>>}

but this value is unmatched.

________________________________________________________________________________
lib/nostrum/voice.ex:556:unmatched_return
The expression produces a value of type:

{_, boolean()}

but this value is unmatched.

________________________________________________________________________________
lib/nostrum/voice.ex:576:unmatched_return
The expression produces a value of type:

:ignore | {:error, _} | {:ok, pid()} | {:ok, pid(), _}

but this value is unmatched.

________________________________________________________________________________
lib/nostrum/voice.ex:755:unmatched_return
The expression produces a value of type:

:ignore | nil | {:error, _} | {:ok, pid()} | {:ok, pid(), _}

but this value is unmatched.

________________________________________________________________________________
lib/nostrum/voice/audio.ex:127:unmatched_return
The expression produces a value of type:

{:error, _} | {:ok, :cancel}

but this value is unmatched.

________________________________________________________________________________
lib/nostrum/voice/audio.ex:139:unmatched_return
The expression produces a value of type:

:ok | {:error, atom()}

but this value is unmatched.

________________________________________________________________________________
lib/nostrum/voice/ports.ex:43:unmatched_return
The expression produces a value of type:

nil | {:ok, pid()}

but this value is unmatched.

________________________________________________________________________________
lib/nostrum/voice/session.ex:124:unmatched_return
The expression produces a value of type:

{:error, _} | {:ok, :cancel}

but this value is unmatched.

________________________________________________________________________________
done (warnings were emitted)

@BrandtHill
Copy link
Contributor

BrandtHill commented Jun 11, 2023

I've added matching to most of these, but the others should be ignored

PR into this branch: #509

@jchristgit
Copy link
Collaborator Author

jchristgit commented Jun 12, 2023 via email

Not all warnings were fixed as Elixir's `is_nil` in conditions does not
seem to play well with dialyzer.
@jchristgit jchristgit marked this pull request as ready for review June 19, 2024 19:01
@jchristgit
Copy link
Collaborator Author

Ready for review.

Copy link
Collaborator

@jb3 jb3 left a comment

Choose a reason for hiding this comment

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

Looks solid, and works locally, so no complaints here.

@jb3 jb3 merged commit ae77945 into master Jun 19, 2024
9 checks passed
@jb3 jb3 deleted the dialyzer-unmatched-return branch June 19, 2024 19:19
@jb3
Copy link
Collaborator

jb3 commented Jun 19, 2024

Thanks!

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