Skip to content
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

Struct pattern in function head does not handle matching variables #93

Open
erszcz opened this issue Jun 1, 2022 · 0 comments
Open
Labels
bug Something isn't working enhancement New feature or request gradualizer-issue Needs addressing in Gradualizer

Comments

@erszcz
Copy link
Member

erszcz commented Jun 1, 2022

  # FIXME: It seems the second attempt/1 clause cannot be reached.
  @spec attempt(%Waiter{}) :: {:ok, %Waiter{}} | {:error, %Waiter{}}
  defp attempt(%Waiter{attempt_num: num, num_attempts: num} = waiter) do

This one seems to be caused by a known limitation in the type checker, i.e. by it not being able to understand variable binds in the struct pattern and the fact that both fields must match. In other words, the problem is on the type checker side, not in the checked code, so it's a false positive.

Originally reported by @baldwindavid in #84

@erszcz erszcz added bug Something isn't working enhancement New feature or request labels Jun 1, 2022
@erszcz erszcz added the gradualizer-issue Needs addressing in Gradualizer label Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request gradualizer-issue Needs addressing in Gradualizer
Projects
None yet
Development

No branches or pull requests

1 participant