-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Functors.children
fails on Type
in Functors v0.5
#94
Comments
Oh that's not good. Are there other objects which are also going to go wrong? julia> using Functors # master branch
julia> fmap(x -> @show(x), (; a=1, b=Int, c=3))
x = 1
ERROR: UndefRefError: access to undefined reference
Stacktrace:
[1] #functor##2
@ ~/.julia/packages/Functors/1RvWk/src/functor.jl:21 [inlined]
[2] ntuple(f::Functors.var"#functor##2#functor##3"{Type{Int64}, NTuple{8, Symbol}}, n::Int64)
@ Base ./ntuple.jl:19
[3] functor(T::Type, x::Type)
@ Functors ~/.julia/packages/Functors/1RvWk/src/functor.jl:21
[4] functor(x::Type)
@ Functors ~/.julia/packages/Functors/1RvWk/src/functor.jl:25
[5] children(x::Type)
@ Functors ~/.julia/packages/Functors/1RvWk/src/functor.jl:58
julia> fmap(x -> @show(x), (; a=1, b=Array, c=3)) # gives awful errors on 1.12 with Functors@0.5
x = 1
x = :T
x = Union{}
ERROR: UndefRefError: access to undefined reference
Stacktrace:
[1] #functor##2
@ ~/.julia/packages/Functors/be90D/src/functor.jl:21 [inlined]
[2] ntuple(f::Functors.var"#functor##2#functor##3"{Type{Any}, NTuple{8, Symbol}}, n::Int64)
@ Base ./ntuple.jl:19
[3] functor(T::Type, x::Type)
@ Functors ~/.julia/packages/Functors/be90D/src/functor.jl:21
[4] functor(x::Type)
@ Functors ~/.julia/packages/Functors/be90D/src/functor.jl:25
[5] children(x::Type) julia> Functors.@leaf DataType # this is not enough
julia> fmap(x -> @show(x), (; a=1, b=Int, c=3))
x = 1
x = Int64
x = 3
(a = 1, b = Int64, c = 3)
julia> fmap(x -> @show(x), (; a=1, b=Array, c=3))
x = 1
x = :T
x = Union{}
x = Any
x = :N
x = Union{}
x = Array{T, N}
x = 3
(a = 1, b = Array{T, N}, c = 3)
julia> Functors.@leaf Type # but perhaps this is?
julia> fmap(x -> @show(x), (; a=1, b=Array, c=3))
x = 1
x = Array
x = 3
(a = 1, b = Array, c = 3)
julia> isstructtype(Int)
false
julia> isstructtype(Array)
true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For example:
while:
The cause seems to be that Functors v0.5 has generic code for walking through structs, which fails for types.
Probably it just requires a definition like:
The text was updated successfully, but these errors were encountered: