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

dump() cross-reference field print recursively. #13370

Open
ghost opened this issue Feb 5, 2022 · 0 comments
Open

dump() cross-reference field print recursively. #13370

ghost opened this issue Feb 5, 2022 · 0 comments
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@ghost
Copy link

ghost commented Feb 5, 2022

V version: 0.2.4 b9fce4e
OS: ArchLinux

What did you do?

struct Window{
mut:
	widgets []Widget
}

struct Widget{
mut:
	parent &Window = voidptr(0)
}

fn main(){
	mut window := &Window{}

	mut btn := &Widget{}
	btn.parent = window

	window.widgets << btn

	dump(window)
}

What did you expect to see?
If a field refers to the struct itself, there is no need to print it.

What did you see instead?

[/home/tsukasa/develop/vprojects/bugs/dump.v:19] window: &Window{
    widgets: [Widget{
        parent: &Window{
            widgets: [Widget{
                parent: &Window{
                    widgets: [Widget{
                        parent: &Window{
                            widgets: [Widget{
                                parent: &Window{
                                    widgets: [Widget{
                                        parent: &Window{
                                            widgets: [Widget{
                                                parent: &Window{
                                                    widgets: [Widget{
                                                        parent: &Window{
                                                            widgets: [Widget{
                                                                parent: &Window{
                                                                    widgets: [Widget{
                                                                        parent: &Window{
                                                                            widgets: [Widget{
                                                                                parent: &Window{
                                                                                    widgets: [Widget{
                                                                                        parent: &Window{
                                                                                            widgets: [Widget{
                                                                                                parent: &Window{
                                                                                                    widgets: [Widget{
                                                                                                        parent: &Window{
                                                                                                            widgets: [Widget{
                                                                                                                parent: &<probably circular>
                                                                                                            }]
                                                                                                        }
                                                                                                    }]
                                                                                                }
                                                                                            }]
                                                                                        }
                                                                                    }]
                                                                                }
                                                                            }]
                                                                        }
                                                                    }]
                                                                }
                                                            }]
                                                        }
                                                    }]
                                                }
                                            }]
                                        }
                                    }]
                                }
                            }]
                        }
                    }]
                }
            }]
        }
    }]
}
@ghost ghost added the Bug This tag is applied to issues which reports bugs. label Feb 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

0 participants