You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the tests/compiling with Elixir 1.18.0, I get the following warnings:
Compiling 1 file (.ex)
warning: this clause in cond will always match:
address_netmask(inet.address)
since it has type:
integer()
where "inet" was given the type:
# type: dynamic(%Postgrex.INET{})
# from: lib/ecto_network/inet.ex:55:29
%Postgrex.INET{} = inet
typing violation found at:
│
59 │ address_netmask(inet.address) -> %{inet | netmask: address_netmask(inet.address)}
│ ~
│
└─ lib/ecto_network/inet.ex:59:39: EctoNetwork.INET.load/1
With the following patch, the warning goes away and all the tests pass:
diff --git a/lib/ecto_network/inet.ex b/lib/ecto_network/inet.ex
index 5f87e2c..ce52a52 100644
--- a/lib/ecto_network/inet.ex
+++ b/lib/ecto_network/inet.ex
@@ -57,7 +57,6 @@ defmodule EctoNetwork.INET do
cond do
address_netmask(inet.address, inet.netmask) -> inet
address_netmask(inet.address) -> %{inet | netmask: address_netmask(inet.address)}
- true -> %{inet | netmask: nil}
end
{:ok, inet}
I am not 100% sure if the tests cover all IP address cases so:
With this patch will the code still behave correctly?
Should I go ahead and submit a PR?
The text was updated successfully, but these errors were encountered:
When running the tests/compiling with Elixir 1.18.0, I get the following warnings:
With the following patch, the warning goes away and all the tests pass:
I am not 100% sure if the tests cover all IP address cases so:
The text was updated successfully, but these errors were encountered: