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

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

Open
agerlach opened this issue Apr 11, 2023 · 3 comments
Open

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

agerlach opened this issue Apr 11, 2023 · 3 comments

Comments

@agerlach
Copy link

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
@oscardssmith
Copy link
Member

hmm, that seems bad

@agerlach
Copy link
Author

My guess is it was introduced in #120

@agerlach
Copy link
Author

Bump... Hit up against this again today.

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

No branches or pull requests

2 participants