julia> using AbstractTrees
julia> struct TypeTree
type::Type
end
julia> function AbstractTrees.children(tree::TypeTree)
Iterators.map(TypeTree, subtypes(tree.type))
end
julia> abstract type A end
julia> struct P <: A end # finitely-many subtypes
julia> struct Q <: A end # finitely-many subtypes
julia> struct R{X} <: A end # infinitely-many subtypes!
julia> leaf_subtypes = Iterators.map((x -> x.type), Leaves(TypeTree(A)));
julia> concrete_leaves = Iterators.filter(isconcretetype, leaf_subtypes);
julia> collect(Type, leaf_subtypes)
3-element Vector{Type}:
P
Q
R
julia> collect(Type, concrete_leaves)
2-element Vector{Type}:
P
Q
Not sure what you mean.