You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2018/03/06 12:28:31 UTC

[couchdb] branch master updated: Fix dialyzer warning on `couch_key_tree:merge/2`

This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 8898104  Fix dialyzer warning on `couch_key_tree:merge/2`
8898104 is described below

commit 88981040a6e4ae464dbbe1c8b186a9a886a23585
Author: ILYA Khlopotov <ii...@apache.org>
AuthorDate: Thu Mar 1 16:59:05 2018 -0800

    Fix dialyzer warning on `couch_key_tree:merge/2`
    
    The spec of `couch_key_tree:merge/2` doesn't include the `path()`
    type. However we pass `path()` in few places. One of such places is
    `couch_db:prep_and_validate_replicated_updates/5`.
    
    ```
    {NewTree, _} = couch_key_tree:merge(AccTree,
        couch_doc:to_path(NewDoc), RevsLimit),
    NewTree
    ```
    
    The spec for `couch_doc:to_path/1` is defined as:
    ```
    -spec to_path(#doc{}) -> path().
    ```
    
    This PR adds `path()` type to `couch_key_tree:merge/2` spec.
---
 src/couch/src/couch_key_tree.erl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/couch/src/couch_key_tree.erl b/src/couch/src/couch_key_tree.erl
index e2e187e..cd661e2 100644
--- a/src/couch/src/couch_key_tree.erl
+++ b/src/couch/src/couch_key_tree.erl
@@ -73,7 +73,7 @@ stem/2
 
 %% @doc Merge a path into the given tree and then stem the result.
 %% Although Tree is of type tree(), it must not contain any branches.
--spec merge(revtree(), tree(), pos_integer()) ->
+-spec merge(revtree(), tree() | path(), pos_integer()) ->
                 {revtree(), new_leaf | new_branch | internal_node}.
 merge(RevTree, Tree, StemDepth) ->
     {Merged, Result} = merge(RevTree, Tree),
@@ -84,7 +84,7 @@ merge(RevTree, Tree, StemDepth) ->
 
 
 %% @doc Merge a path into a tree.
--spec merge(revtree(), tree()) ->
+-spec merge(revtree(), tree() | path()) ->
                 {revtree(), new_leaf | new_branch | internal_node}.
 merge(RevTree, Tree) ->
     {Merged, Result} = merge_tree(RevTree, Tree, []),
@@ -94,7 +94,7 @@ merge(RevTree, Tree) ->
 %% @doc Attempt to merge Tree into each branch of the RevTree.
 %% If it can't find a branch that the new tree merges into, add it as a
 %% new branch in the RevTree.
--spec merge_tree(revtree(), tree(), revtree()) ->
+-spec merge_tree(revtree(), tree() | path(), revtree()) ->
                 {revtree(), new_leaf | new_branch | internal_node}.
 merge_tree([], Tree, []) ->
     {[Tree], new_leaf};

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.