gradient icon indicating copy to clipboard operation
gradient copied to clipboard

Gradient doesn't understand `nonempty_improper_list`

Open mariari opened this issue 10 months ago • 0 comments

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

mariari avatar Mar 27 '24 03:03 mariari