You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ji...@apache.org on 2024/12/30 17:56:22 UTC

(couchdb) 07/07: Fix warnings about comparison between distinct types

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

jiahuili430 pushed a commit to branch fix-elixir-compile-warnings
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 54a2baee1e3994b94d4dae5886f9b9dcbb397b15
Author: Jiahui Li <li...@gmail.com>
AuthorDate: Mon Dec 30 11:51:20 2024 -0600

    Fix warnings about comparison between distinct types
    
    ```
          warning: comparison between distinct types found:
    
              N >= 10
    
          given types:
    
              N >= integer()
    
          While Elixir can compare across all types, you are comparing across types which are always disjoint, and the result is either always true or always false
    
          typing violation found at:
          │
     1310 │         N when (N >= 10 and N < 15) or is_ddoc ->
          │                   ~
          │
          └─ test/elixir/test/replication_test.exs:1310:19: ReplicationTest.run_continuous_repl/2
    ```
---
 test/elixir/test/replication_test.exs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/elixir/test/replication_test.exs b/test/elixir/test/replication_test.exs
index 09f3e2417..f6658deed 100644
--- a/test/elixir/test/replication_test.exs
+++ b/test/elixir/test/replication_test.exs
@@ -1307,7 +1307,7 @@ defmodule ReplicationTest do
       is_ddoc = String.starts_with?(doc["_id"], "_design/")
 
       case doc["integer"] do
-        N when (N >= 10 and N < 15) or is_ddoc ->
+        n when (n >= 10 and n < 15) or is_ddoc ->
           resp = Couch.get!("/#{tgt_db_name}/#{doc["_id"]}")
           atts = resp.body["_attachments"]
           assert is_map(atts)