bitwalker / bitwalker/libgraph

Wrong return value in @spec for Graph.in_edges().

Open
#87 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Elixir
Stars
571
Forks
76
PR merge metrics
No merged PRs in 30d

Description

Hello. As I understand from the documentation, `Graph.in_edges()` is supposed to return "a list of `Graph.Edge`". However, the [`@spec`](https://github.com/bitwalker/libgraph/blob/main/lib/graph.ex#L2122C3-L2122C40) declares that only one edge is returned.
```elixir
@spec in_edges(t, vertex) :: Edge.t()
```

This is causing Dialyzer some discomfort:
```
Line 1193 Column 9: The pattern [Edge] can never match the type #{'__struct__':='Elixir.Graph.Edge', 'label':=_, 'v1':=_, 'v2':=_, 'weight':=number()}
Line 1194 Column 9: The pattern [Edge | More] can never match the type #{'__struct__':='Elixir.Graph.Edge', 'label':=_, 'v1':=_, 'v2':=_, 'weight':=number()}
```

Note that I'm using libgraph from an Erlang module, but of course, that shouldn't matter. I'm using version 0.16.0 of the library.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.