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

riakc_obj:new spec type is incorrect [JIRA: CLIENTS-907] #298

Open
gleber opened this issue Jul 6, 2016 · 2 comments
Open

riakc_obj:new spec type is incorrect [JIRA: CLIENTS-907] #298

gleber opened this issue Jul 6, 2016 · 2 comments

Comments

@gleber
Copy link

gleber commented Jul 6, 2016

Current it is defined as:

-spec new(bucket(), key(), value(), content_type()) -> riakc_obj().

while code suggests it should be

-spec new(bucket(), key(), value(), content_type()) -> riakc_obj() | {error, atom()}.

@Basho-JIRA Basho-JIRA changed the title riakc_obj:new spec type is incorrect riakc_obj:new spec type is incorrect [JIRA: CLIENTS-907] Jul 6, 2016
@gleber
Copy link
Author

gleber commented Jul 6, 2016

I am not entirely sure why this happens, but there's also the following effect:

The variable Obj can never match since previous clauses completely covered the type {'error','zero_length_bucket' | 'zero_length_key'}

reported for the following code:

case riakc_obj:new(<<"test">>, <<"foo">>, <<"bar">>) of
    {error, Error} -> erlang:error({error, Error});
    Obj -> io:fwrite("~p~n", [Obj])
end

Somehow Dialyzer of OTP 19.0.1 thinks that riakc_obj:new/3 can only return error tuples, but not riakc_obj()

@lukebakken
Copy link
Contributor

There seems to be dialyzer issue with OTP 19. Going to move this to 2.5.0 for now. Thanks for the report ... and a PR would be welcome if you have time 🍥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants