Skip to content

Gradient doesn't understand nonempty_improper_list #181

@mariari

Description

@mariari

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions