Skip to content

match? pattern seems to not affect the type #98

Open
@LostKobrakai

Description

@LostKobrakai
lib/a.ex:6: The variable is expected to have type nonempty_list(A) but it has type list(integer())
4     cond do
5       [] == list -> 0
6       match?([_a], list) -> list |> hd()
7       true -> Enum.max(list)
8     end

I'm not sure where the issue comes from or if it's supposed to be covered, but neither match? nor a normal function pattern matching on the list holding one item will make the type be refined to nonempty_list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    elixir-syntaxSpecific to Elixir syntax with no direct Erlang equivalentenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions