We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
code: https://go2goplay.golang.org/p/6EKNV4FQ4KI
Compiles
Doesn't compile
BTW, is type (v *Vertex) Edges() []*FromTo { ... } a typo of func (v *Vertex) Edges() []*FromTo { ... }
type (v *Vertex) Edges() []*FromTo { ... }
func (v *Vertex) Edges() []*FromTo { ... }
The text was updated successfully, but these errors were encountered:
I'm not saying it's normal, but if you want to make the example compile you need provide explicit type parameters when instantiating Graph:
Graph
g := New(*Vertex, *FromTo)([]*Vertex{}) // ok
Also, while I understand the error message for:
g := New(Vertex, *FromTo)([]*Vertex{}) // error: *Vertex does not satisfy NodeConstraint(Edge) (missing method Edges)
I'm not sure I understand why it says the same thing in the following case, since the Vertex type parameter is now correct:
Vertex
g := New(*Vertex, FromTo)([]*Vertex{}) // error: Vertex does not satisfy NodeConstraint(Edge) (missing method Edges)
Or maybe is it because there's a mismatch for the 1st type parameter, between Vertex (inferred from FromTo) and *Vertex?
FromTo
*Vertex
Sorry, something went wrong.
OK, but maybe it is possible to deduce the Edge type as *FromTo from the New([]*Vertex{}) call, for *Vertex has a Edges() []*FromTo method.
Edge
*FromTo
New([]*Vertex{})
Edges() []*FromTo
This seems like a question which has been answered.
No branches or pull requests
What did you do?
code: https://go2goplay.golang.org/p/6EKNV4FQ4KI
What did you expect to see?
Compiles
What did you see instead?
Doesn't compile
BTW, is
type (v *Vertex) Edges() []*FromTo { ... }
a typo offunc (v *Vertex) Edges() []*FromTo { ... }
The text was updated successfully, but these errors were encountered: