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

Pull Request for Issue #719 #723

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

NehaDalmia
Copy link

@NehaDalmia NehaDalmia commented Jan 21, 2021

Added the clause to check if a type is Scalar before iterating it.
fixes #719

src/disjoint_set.jl Outdated Show resolved Hide resolved
Co-authored-by: Koustav Chowdhury <[email protected]>
@NehaDalmia
Copy link
Author

The bug was arising as it was attempting to iterate over a non-iterable Symbol object. The Scalar struct declared is used to determine whether a given variable is iterable or not, if not we create a DisjointSet having just one element of the non iterable type. If it is iterable , we iterate over its members and the DisjointSet is created with these members.

@oxinabox
Copy link
Member

oxinabox commented Feb 3, 2021

I don't think this is the right solution.
Constructors for collections should not accept single elements.
They always should take iterators; the user should have to put the thing into a collection before hand.
Like:

julia> Set(:a)
ERROR: MethodError: no method matching length(::Symbol)

julia> Set([:a])
Set{Symbol} with 1 element:
  :a

We should find out why this is not throwing a MethodError and was instead infinitely recursing.

Also PR should have a test to prevent the bug occuring again in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creating a DisjointSets forest from a single symbol results in an infinite type loop.
3 participants