Skip to content

Error in v0.4.3 when building trees over subtypes #134

Open
@agerlach

Description

@agerlach

I historically used the following code to build a tree over subtypes. This works in v0.4.2, but fails in v0.4.3.

using AbstractTrees
AbstractTrees.children(t::Type) = subtypes(t)
first(Leaves(Number))
ERROR: MethodError: Cannot `convert` an object of type Tuple{DataType, Int64} to an object of type Nothing
Closest candidates are:
  convert(::Type{Nothing}, ::Any) at some.jl:37
  convert(::Type{T}, ::Any) where T>:Nothing at some.jl:36
  convert(::Type{Nothing}, ::Nothing) at some.jl:38
  ...
Stacktrace:
  [1] convert(#unused#::Type{Nothing}, x::Tuple{DataType, Int64})
    @ Base ./some.jl:37
  [2] ImplicitCursor(p::ImplicitCursor{DataType, Nothing, Any}, n::Type, s::Tuple{DataType, Int64})
    @ AbstractTrees ~/.julia/packages/AbstractTrees/EUx8s/src/cursors.jl:149
  [3] iterate(csr::ImplicitCursor{DataType, Nothing, Any}, s::AbstractTrees.InitialState)
    @ AbstractTrees ~/.julia/packages/AbstractTrees/EUx8s/src/cursors.jl:174
  [4] iterate
    @ ~/.julia/packages/AbstractTrees/EUx8s/src/cursors.jl:167 [inlined]
  [5] isempty
    @ ./essentials.jl:788 [inlined]
  [6] descendleft(node::ImplicitCursor{DataType, Nothing, Any})
    @ AbstractTrees ~/.julia/packages/AbstractTrees/EUx8s/src/base.jl:176
  [7] call_composed
    @ ./operators.jl:1039 [inlined]
  [8] (::ComposedFunction{ComposedFunction{Type{AbstractTrees.LeavesState}, typeof(descendleft)}, Type{TreeCursor}})(x::Type; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./operators.jl:1035
  [9] ComposedFunction
    @ ./operators.jl:1033 [inlined]
 [10] initial
    @ ~/.julia/packages/AbstractTrees/EUx8s/src/iteration.jl:231 [inlined]
 [11] iterate(ti::Leaves{DataType})
    @ AbstractTrees ~/.julia/packages/AbstractTrees/EUx8s/src/iteration.jl:74
 [12] first(itr::Leaves{DataType})
    @ Base ./abstractarray.jl:424
 [13] top-level scope
    @ REPL[8]:1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions