Treeset iterator is broken #110
Labels
No labels
bug
discussion
documentation
duplicate
ignore
new feature
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
golibs/gms-gods#110
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
How to reproduce:
This bug breaks everything and makes
treesetimpossible to use. Just for instance:tree.Values()falls down withindex out of rangeagreed, this library should definitely be avoided. This is not something anyone should use in production code.
Please add full code to reproduce this. There are many tests for the TreeSet, what is "someComparator" and "someItems"?
@churrodog it's used in a "few" production systems. Not to say that I exclude the possibility of bugs, but the years of maturity and the number of tests outweighs the lack of arguments in your comment. You have no time to file a proper bug report, a reproducible snippet of code, not to mention a fix? In that case...
There was a bug filed in april, it was ignored, and now closed. No worries.....
None of these comments are constructive. Here's an example to reproduce the problem:
Please reopen this issue.
@c3mb0 thanks for the snippet, constructive, will fix
Is this code still maintained? If yes I can resolve this issue.
@hetulbhatt yes it is, feel free to resolve the issue.
Actually, the problem is, the comparator @c3mb0 used is not consistent. It doesn't return 0 for equivalent objects. Maybe if it was
return h2.Y*10 - abs(h2.X) - h1.Y*10 + abs(h1.X), it would work.After investigating the example from @c3mb0 and based on @hetulbhatt comment, the comparator needs to be consistent. I assume the same problem with @grglcs "someComparator" (unfortunately the code is not given to verify).
Essentially if you have a comparator that returns something inconsistent. Otherwise, the nodes can not be ingested in a tree in the order given by the comparator.
Basically, the example suggests that a is less than c and that c is less than a