-
Notifications
You must be signed in to change notification settings - Fork 18
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
Some generated clauses can never match #26
Comments
Having the same problem, bit annoying in the CI/CD pipeline, is there a quick fix for this? thanks |
I took a look at this. Here's a minimal example of the issue: defmodule Demo do
@doc """
iex> my_match(["com", "customer-oci"])
:match2plus
iex> my_match(["com", "customer-oci", "a"])
:match3
iex> my_match(["com", "customer-oci", "a", "b"])
:match4
iex> my_match(["com", "customer-oci", "a", "b", "c"])
:match2plus
iex> my_match(["com", "customer-oci"])
:match2plus
iex> my_match(["com", "customer-oci", "oci"])
:match3
iex> my_match(["com", "customer-oci", "oci", "b"])
:match4
iex> my_match(["com", "customer-oci", "oci", "b", "c"])
:match2plus
iex> my_match(["com", "customer-oci"])
:match2plus
iex> my_match(["com", "customer-oci", "ocp"])
:match3
iex> my_match(["com", "customer-oci", "ocp", "b"])
:match4
iex> my_match(["com", "customer-oci", "ocp", "b", "c"])
:match2plus
"""
for suffix <- [
["com", "customer-oci", "oci", "*"],
["com", "customer-oci", "ocp", "*"]
] do
# matches list of length 3
def my_match([unquote(Enum.at(suffix, 0)), unquote(Enum.at(suffix, 1)), _a]) do
:match3
end
# matches list of length 4
def my_match([unquote(Enum.at(suffix, 0)), unquote(Enum.at(suffix, 1)), _a, _b]) do
:match4
end
# matches list of length 2+
def my_match([unquote(Enum.at(suffix, 0)), unquote(Enum.at(suffix, 1)) | _] = _args) do
:match2plus
end
end
end The problem is that the "same" function head is being defined multiple times (e.g. since only the first two parts of the suffix are used in the match). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiling the library results in ~40 warnings like:
I'm not yet sure how to determine which entries in the PSL cause these or whether it's a problem.
The text was updated successfully, but these errors were encountered: