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 enqueue! typespec #50

Merged
merged 1 commit into from
Jan 30, 2018
Merged

Fix enqueue! typespec #50

merged 1 commit into from
Jan 30, 2018

Conversation

indrekj
Copy link
Contributor

@indrekj indrekj commented Jan 6, 2018

It seems that dialyzer is not checking this typespec. Its probably
related to macros but I'm not entirely sure. TaskBunny.Job.enqueue!
spec clearly says that only return value is :ok.

This was discovered when using this library in an application:

lib/transporter/delivery_requests/delivery_job.ex:5: The specification
for 'Elixir.Transporter.DeliveryRequests.DeliveryJob':'enqueue!'/2
  states that the function might also return {'error',_} but the
  inferred return is 'ok'

@ono
Copy link
Contributor

ono commented Jan 29, 2018

Oh, sorry, didn't notice the PR until now. Good spot but enqueue! would never return {:error, any}.

I guess we need to remove | {:error, any} from..

https://github.com/shinyscorpion/task_bunny/blob/master/lib/task_bunny/job.ex#L199

Would you mind update the PR? Or I will do it sometime soon.

It seems that dialyzer is not checking this typespec. Its probably
related to macros but I'm not entirely sure. `TaskBunny.Job.enqueue!`
spec clearly says that only return value is :ok.

This was discovered when using this library in an application:
```
lib/transporter/delivery_requests/delivery_job.ex:5: The specification
for 'Elixir.Transporter.DeliveryRequests.DeliveryJob':'enqueue!'/2
  states that the function might also return {'error',_} but the
  inferred return is 'ok'
```
@indrekj
Copy link
Contributor Author

indrekj commented Jan 29, 2018

updated

@ono ono merged commit 5056477 into shinyscorpion:master Jan 30, 2018
@ono
Copy link
Contributor

ono commented Jan 30, 2018

Awesome. 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