Skip to content

Dialyzer fixes #96

merged 14 commits into from Mar 26, 2012

2 participants


No description provided.

rzezeski added some commits Oct 15, 2011
@rzezeski rzezeski Remove old entries from ignore file 68a3715
@rzezeski rzezeski Allow multiline queries
A multiline query cases a badmatch because the parser assumes single line
queries.  Changing the pattern and testing a few multiline queries showed they
are parsed just the same as their single line counterparts.
@rzezeski rzezeski Use canonical riak_object type
This fixes some dialyzer errors that, frankly, confused me very much.
@rzezeski rzezeski Fix spec for make_indexed_doc ac674d9
@rzezeski rzezeski Use more specific type for idxdoc 8466770
@rzezeski rzezeski Remove unreachable code
Since a list is always passed to this function the first function head can
never match.
@rzezeski rzezeski Make dialyzer happy
Dialyzer was giving me the following warning so I refactored into a map call
which I think looks cleaner anyways.

    The pattern [{{Idx, Node}, 'primary'} | _] can never match the type []
@rzezeski rzezeski Add canonical index type
Add a canonical index type that all of riak_search, as well as it's clients,
can reference.
@rzezeski rzezeski Add specs to Search/Merge Index boundary 458a073
@rzezeski rzezeski Remove unused macros 38e6643
@rzezeski rzezeski Move spec next to function 3d35ace
@rzezeski rzezeski Spec out the query stream code
Gave a good first round spec-out of the query streaming code.  Some of the specs
could be tighter.  All good things come with time.
@rzezeski rzezeski Fix spec for index_object e64c4fc
@rzezeski rzezeski Remove unreachable code
I'm not sure how it ever got there but this code cannot be reached as the
string/1 fun will always return either `{ok, Tokens, Line}` or
`{error, Error, Line}`.
Basho Technologies member

:trollface: I saw a meaningless micro-benchmark on the erlang ML that says list comprehensions are much faster, and Kostis said the same when he talked about his refactoring tool at EF London :trollface:

lists:map (in this case) is easier to read.

Interesting, yea I remember andrew telling me list comprehensions are the fastest method of iterating list. I just gave up because dialyzer was trolling me. I haven't seen this fun dominate any of the fprof analysis I've done yet but I'll remember to keep your note in mind.

Basho Technologies member

A quick grep seems to point at this only being called with a list…did you refactor out calls to it with an array, or was it old, dead code?

Yes, it is dead code.

Basho Technologies member

I still get some dialyzer warnings, but the changes all look good, and search still passes tests. +1 to merge.

@rzezeski rzezeski was assigned Mar 26, 2012
Basho Technologies member

Those warnings

Proceeding with analysis...
merge_index_backend.erl:151: Type specification merge_index_backend:stream_to(itr_result(),sender()) -> any() is a       supertype of the success typing:  merge_index_backend:stream_to('eof' | {_,_},'ignore' | {'fsm','undefined' |   reference(),pid()} | {'raw',reference(),pid()}) -> any()
riak_search_config.erl:51: Type specification riak_search_config:get_schema(any()) -> {'ok',any()} | {'error','badarg'} | any() is a supertype of the success typing: riak_search_config:get_schema(atom() | binary() | maybe_improper_list(binary()  | maybe_improper_list(any(),binary() | []) | byte(),binary() | []) | integer() | tuple()) -> any()
riak_search_op_term.erl:60: Type specification riak_search_op_term:start_loop(any(),pid(),reference(),#search_state{}) -> any() is a supertype of the success typing: riak_search_op_term:start_loop(#term{},pid(),reference(),#search_state{}) ->  {'disconnect',_} | {'error',_}
riak_search_utils.erl:116: Type specification riak_search_utils:choose([any()]) -> any() is a supertype of the success typing: riak_search_utils:choose([any(),...]) -> any()
riak_search_utils.erl:176: The variable Error can never match since previous clauses completely covered the type {'value',_,[{_,_}]}
@rzezeski rzezeski merged commit 7818ac9 into basho:master Mar 26, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.