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

Allow UnionAll as input to subtypes and include UnionAll in its output #20307

Merged
merged 2 commits into from
Feb 3, 2017

Conversation

yuyichao
Copy link
Contributor

Replaces #20084 with tests mostly taken from it.

end
end
end
return sts
end
subtypes(m::Module, x::DataType) = sort(collect(_subtypes(m, x)), by=string)
subtypes(m::Module, x::Union{DataType,UnionAll}) = sort(collect(_subtypes(m, x)), by=string)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sort!(collect(...))?

@yuyichao yuyichao force-pushed the yyc/subtypes branch 2 times, most recently from dd4e531 to c6d705e Compare January 29, 2017 14:16
@vtjnash
Copy link
Member

vtjnash commented Jan 29, 2017

Lgtm. Although none of those type asserts should be impactful.

@yuyichao
Copy link
Contributor Author

Removed the subtypes(Integer) test since the examples test defines an Integer subtype and break this test. Not sure why it causes the test to hang though.

@yuyichao
Copy link
Contributor Author

The hang was causing by trying to serialize/deserialize ModInt from the example test module from a previous test. Presumably similar to other test system serialization problems.

@kshyatt kshyatt added the types and dispatch Types, subtyping and method dispatch label Jan 29, 2017
@yuyichao
Copy link
Contributor Author

yuyichao commented Jan 30, 2017

Rebased to resolve conflict with #19964, will probably rebased after #20006 is merged again in order to use isabstract and merge after that.

@yuyichao
Copy link
Contributor Author

yuyichao commented Feb 1, 2017

Rebased on top of #20006.

end
end
end
return sts
end
subtypes(m::Module, x::DataType) = x.abstract ? sort!(collect(_subtypes(m, x)), by=string) : DataType[]
subtypes(m::Module, x::Union{DataType,UnionAll}) = isabstract(x) ? sort!(collect(_subtypes(m, x)), by=string) : Union{DataType,UnionAll}[]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getting to be a long line, either wrap or give the union a shorter alias?

@yuyichao yuyichao merged commit 754d8e8 into master Feb 3, 2017
@yuyichao yuyichao deleted the yyc/subtypes branch February 3, 2017 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants