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

EqualityForAccumulators #275

Merged
merged 1 commit into from
Mar 10, 2017
Merged

EqualityForAccumulators #275

merged 1 commit into from
Mar 10, 2017

Conversation

oxinabox
Copy link
Member

@oxinabox oxinabox commented Mar 10, 2017

Before:

julia> using DataStructures

julia> counter([2,3,4]) == counter([2,4,3]) 
ERROR: MethodError: no method matching get(::DataStructures.Accumulator{Int64,Int64}, ::Int64, ::Symbol)
Closest candidates are:
  get(::ObjectIdDict, ::ANY, ::ANY) at dict.jl:284
  get(::AbstractArray{T,N}, ::Integer, ::Any) at abstractarray.jl:912
  get{K,V}(::Dict{K,V}, ::Any, ::Any) at dict.jl:692
  ...
 in in(::Pair{Int64,Int64}, ::DataStructures.Accumulator{Int64,Int64}, ::Base.#==) at ./dict.jl:10
 in ==(::DataStructures.Accumulator{Int64,Int64}, ::DataStructures.Accumulator{Int64,Int64}) at ./dict.jl:209

Now:

julia> using DataStructures

julia> counter([2,3,4]) == counter([2,4,3]) 
ERROR: MethodError: no method matching get(::DataStructures.Accumulator{Int64,Int64}, ::Int64, ::Symbol)
Closest candidates are:
  get(::ObjectIdDict, ::ANY, ::ANY) at dict.jl:284
  get(::AbstractArray{T,N}, ::Integer, ::Any) at abstractarray.jl:912
  get{K,V}(::Dict{K,V}, ::Any, ::Any) at dict.jl:692
  ...
 in in(::Pair{Int64,Int64}, ::DataStructures.Accumulator{Int64,Int64}, ::Base.#==) at ./dict.jl:10
 in ==(::DataStructures.Accumulator{Int64,Int64}, ::DataStructures.Accumulator{Int64,Int64}) at ./dict.jl:209

Turns out, that all subclasses of Associative,
should implement get(store, key, default)
or otherwise several things break

@codecov
Copy link

codecov bot commented Mar 10, 2017

Codecov Report

Merging #275 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #275      +/-   ##
==========================================
+ Coverage   95.87%   95.87%   +<.01%     
==========================================
  Files          30       30              
  Lines        2228     2229       +1     
==========================================
+ Hits         2136     2137       +1     
  Misses         92       92
Impacted Files Coverage Δ
src/accumulator.jl 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c114f0...8ccd860. Read the comment docs.

@kmsquire kmsquire merged commit 93301f6 into JuliaCollections:master Mar 10, 2017
@kmsquire
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants