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

Fix typespecs for some functions #208

Merged
merged 1 commit into from
Jul 28, 2023
Merged

Fix typespecs for some functions #208

merged 1 commit into from
Jul 28, 2023

Conversation

RobinBoers
Copy link
Contributor

Hi, I was using this library and dialyzer started to complain:

lib/dummy/dummy.ex:94:call
The function call will not succeed.

Req.put([
  {:body, binary()} | {:headers, [{<<_::72>>, _}, ...]} | {:url, <<_::8, _::size(1)>>},
  ...
])

will never return since the 1st arguments differ
from the success typing arguments:

(
  binary()
  | %{
      :__struct__ => Req.Request | URI,
      :adapter => (... -> any),
      :authority => URI.authority(),
      :body =>
        nil
        | binary()
        | maybe_improper_list(
            binary() | maybe_improper_list(any(), binary() | []) | byte(),
            binary() | []
          ),
      :current_request_steps => _,
...

So I took a look at the source code, and saw that for some functions the keyword() type was missing in the typespec, while all those functions had a clause to handle keyword lists, and the docs clearly said a keyword list was accepted.

So I added them, and also made the docs for get/2 consistent with the rest.

@wojtekmach wojtekmach merged commit e86effa into wojtekmach:main Jul 28, 2023
2 checks passed
@wojtekmach
Copy link
Owner

Thank you!

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.

2 participants