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

Incorrect @spec for authorize_url/2 #158

Open
diogomrts opened this issue Oct 11, 2024 · 0 comments
Open

Incorrect @spec for authorize_url/2 #158

diogomrts opened this issue Oct 11, 2024 · 0 comments

Comments

@diogomrts
Copy link

I noticed that the @spec for the authorize_url/2 function in the Assent library is incorrect and does not match its actual return values. Specifically, the spec does not account for the {:error, term()} case, which causes issues with Dialyzer.

Current @SPEC

@spec authorize_url(Keyword.t(), module()) ::
  {:ok, %{session_params: %{state: binary()}, url: binary()}}

Actual Behavior

According to the implementation, the function can return either:

  • {:ok, %{session_params: %{state: binary()}, url: binary()}}
  • {:error, term()}

The @spec should reflect this, but currently, it only defines the {:ok, ...} case.

Steps to Reproduce

  1. Use the authorize_url/2 function in a project with Dialyzer enabled.
  2. Pattern match against {:error, _} in the function's return value.
  3. Observe Dialyzer warnings indicating that the pattern {:error, _} can never match.
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