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

when <circular> printing does not show the number of item in the array #21689

Open
Eliyaan opened this issue Jun 17, 2024 · 2 comments
Open

when <circular> printing does not show the number of item in the array #21689

Eliyaan opened this issue Jun 17, 2024 · 2 comments
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@Eliyaan
Copy link
Contributor

Eliyaan commented Jun 17, 2024

Describe the bug

When printing a struct with an array that prints as [<circular>], it does not show the number of items in the array.

Reproduction Steps

 struct Bar {
 mut:
         children []Bar
 }
 
 fn main() {
         mut a := Bar{}
         a.children << Bar{}
         a.children << Bar{}
         println(a)
         println(a.children)
}

Expected Behavior

Bar{
    children: [<circular>, <circular>]
}
[Bar{
    children: []
}, Bar{
    children: []
}]

Current Behavior

Bar{
    children: [<circular>]
}
[Bar{
    children: []
}, Bar{
    children: []
}]

Possible Solution

No response

Additional Information/Context

And maybe instead of <circular> the print could show <circular?> as it does not know whether or not it is circular.

V version

V full version: V 0.4.6 294f7e4.bebe943

Environment details (OS name and version, etc.)

V full version: V 0.4.6 294f7e4.bebe943
OS: linux, Linux version 6.7.11-200.fc39.x86_64 (mockbuild@bdb8d24f206645e2bda44c1cf867612d) (gcc (GCC) 13.2.1 20240316 (Red Hat 13.2.1-7), GNU ld version 2.40-14.fc39) #1 SMP PREEMPT_DYNAMIC Wed Mar 27 16:50:39 UTC 2024

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@Eliyaan Eliyaan added the Bug This tag is applied to issues which reports bugs. label Jun 17, 2024
@JalonSolov
Copy link
Contributor

The problem it is reporting is circular references. Why would you need to know how many were in the same array?

@Eliyaan
Copy link
Contributor Author

Eliyaan commented Jun 17, 2024

Because it is useful when debugging to know how many items are in the array. related conversation: https://discord.com/channels/592103645835821068/592106336838352923/1251933620214693978

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

No branches or pull requests

2 participants