FluxML / FluxML/Functors.jl

Bug in `functor(::Type{NamedTuple}, Any)`

Open
#38 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
123
Forks
18
Avg merge
47m
Merged PRs (30d)
1

Description

I think this is a bug -- `functor(typeof(x), y)` should always use `x`'s field names on `y`:
```julia
julia> struct Foo; x; y; end

julia> @functor Foo

julia> struct AnotherFoo; x; y; end

julia> x = Foo([1, 2], 3);

julia> y = AnotherFoo([4, 5], 6);

julia> z = (x = [7, 8], y = 9);

julia> functor(x)
((x = [1, 2], y = 3), var"#31#32"())

julia> functor(typeof(x), y)
((x = [4, 5], y = 6), var"#31#32"())

julia> functor(typeof(z), y) # this is wrong?
(AnotherFoo([4, 5], 6), Functors.var"#5#6"())
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.