Skip to content
New issue

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

multiple recursive fields in a struct #1304

Closed
mvertes opened this issue Oct 25, 2021 · 0 comments · Fixed by #1305
Closed

multiple recursive fields in a struct #1304

mvertes opened this issue Oct 25, 2021 · 0 comments · Fixed by #1305
Labels
area/core bug Something isn't working
Milestone

Comments

@mvertes
Copy link
Member

mvertes commented Oct 25, 2021

The following program sample.go triggers an unexpected result

package main

type Node struct {
    Name  string
    Alias *Node
    Child []*Node
}   

func main() {
    n := &Node{Name: "parent"}
    n.Child = append(n.Child, &Node{Name: "child"})
    println(n.Name, n.Child[0].Name)
}

Expected result

$ go run ./sample.go
parent child

Got

$ yagi ./sample.go
./sample.go:11:28: cannot use type *main.Node as type *unsafe2.dummy

Yaegi Version

v0.10.0

Additional Notes

This issue is related to #1296.

Note also that if we comment the unused field Alias *Node in type definition, the test works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant