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

Gradient doesn't understand nonempty_improper_list #181

Open
mariari opened this issue Mar 27, 2024 · 0 comments
Open

Gradient doesn't understand nonempty_improper_list #181

mariari opened this issue Mar 27, 2024 · 0 comments

Comments

@mariari
Copy link

mariari commented Mar 27, 2024

Here is a reproducible example

  @type failed() :: nonempty_improper_list(number(), number())

  @spec foo() :: failed()
  def foo() do
    [2, 1 | 0]
  end

Ends up with the message

lib/nock.ex: The pattern [id, key | zero] on line 1249 doesn't have the type noun_atom() | noun_cell()

lib/nock.ex: The list on line 1277 is expected to have type failed() but it has type nonempty_list()
1275   @spec foo() :: failed()
1276   def foo() do
1277     [2, 1 | 0]
1278   end
1279 end

To get this to work, I have to replace this with this

  @type failed() :: list(number) | number()

As it resolves [...] as solely a list, and then number as the termination matching

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant