Skip to content

Commit

Permalink
fix == on Reductions (#545)
Browse files Browse the repository at this point in the history
  • Loading branch information
MasonProtter authored Nov 27, 2022
1 parent bd958e4 commit 142abcb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ struct Reduction{X <: Transducer, I} <: AbstractReduction{I}
end
end

Base.:(==)(r1::Reduction, r2::Reduction) = (r1.xform == r2.xform) && (r1.inner == r2.inner)

if VERSION < v"1.3" # pre https://github.com/JuliaLang/julia/pull/31916
@inline (rf::Reduction)(state, input) = next(rf, state, input)
end
Expand Down
9 changes: 1 addition & 8 deletions test/test_show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,8 @@ end
$code
"""
VERSION < v"1.5-beta" && occursin("", code) && continue
xf isa GetIndex && continue
rf2 = include_string(@__MODULE__, code)
if xf isa GetIndex
# This is casued by Base.:(==)(::AbstractReduction, ::AbstractReduction) falling back on ===
# https://github.com/JuliaFolds/Transducers.jl/issues/540
@test_broken rf == rf2
else
@test rf == rf2
end
@test rf == rf2
end
end

Expand Down

0 comments on commit 142abcb

Please sign in to comment.