Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Starting from version 0.19.0, CHANGELOG.md is managed in a format that follows <https://keepachangelog.com/en/1.1.0/>.

<!-- links start -->
[Unreleased]: https://github.com/JuliaCollections/DataStructures.jl/compare/v0.19.0...HEAD
[Unreleased]: https://github.com/JuliaCollections/DataStructures.jl/compare/v0.19.7...HEAD
[0.19.0]: https://github.com/JuliaCollections/DataStructures.jl/compare/v0.18.22...v0.19.0
[0.19.1]: https://github.com/JuliaCollections/DataStructures.jl/compare/v0.19.0...v0.19.1
[0.19.2]: https://github.com/JuliaCollections/DataStructures.jl/compare/v0.19.1...v0.19.2
Expand All @@ -12,6 +12,12 @@ Starting from version 0.19.0, CHANGELOG.md is managed in a format that follows <
[0.19.7]: https://github.com/JuliaCollections/DataStructures.jl/compare/v0.19.6...v0.19.7
<!-- links end -->

[Unreleased]
====================

## Fixed
- # Fixed #1001: `empty` on a `DefaultDictBase` threw a `MethodError`

[0.19.7]
====================

Expand Down
2 changes: 1 addition & 1 deletion src/default_dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ DefaultDictBase{K,V}(default::F; kwargs...) where {K,V,F} = DefaultDictBase{K,V,

Create an empty DefaultDictBase with the same default and passkey settings.
"""
Base.empty(d::DefaultDictBase{K,V,F}) where {K,V,F} = DefaultDictBase{K,V,F}(d.default; passkey=d.passkey)
Base.empty(d::DefaultDictBase{K,V,F,D}) where {K,V,F,D} = DefaultDictBase{K,V,F,D}(d.default; passkey=d.passkey)

"""
getindex(d::DefaultDictBase, key)
Expand Down
4 changes: 4 additions & 0 deletions test/test_default_dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import DataStructures: DefaultDictBase, OrderedDict
@test isa(DefaultDictBase{Int, String}(String), DefaultDictBase{Int, String, typeof(String), Dict{Int, String}})
@test isa(DefaultDictBase{Int, String}(String; passkey=true), DefaultDictBase{Int, String, typeof(String), Dict{Int, String}})
@test isa(DefaultDictBase{Int, String}(String; passkey=false), DefaultDictBase{Int, String, typeof(String), Dict{Int, String}})

e = empty(DefaultDictBase{Int, String}(string; passkey=true))
@test isa(e, DefaultDictBase{Int, String, typeof(string), Dict{Int, String}})
@test e[1] == "1"
end

@testset "DefaultDict" begin
Expand Down
Loading