Skip to content

Commit

Permalink
Make DefaultDictBase signature valid on Julia master
Browse files Browse the repository at this point in the history
Hoping this is temporary until the type system can take care of it again. Closes #62.
  • Loading branch information
garborg committed Oct 25, 2014
1 parent 5528b15 commit 63a9266
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/defaultdict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@
# subclassed.
#

immutable DefaultDictBase{K,V,F,D<:Associative{K,V}} <: Associative{K,V}
immutable DefaultDictBase{K,V,F,D} <: Associative{K,V}
default::F
d::D

DefaultDictBase(x::F, kv::AbstractArray{(K,V)}) = new(x, D(kv))
DefaultDictBase(x::F, d::DefaultDictBase) = DefaultDictBase(x, d.d)
DefaultDictBase(x::F, d::D=D()) = new(x, d)
DefaultDictBase(x, ks, vs) = new(x, D(ks,vs))
check_D(D,K,V) = (D <: Associative{K,V}) ||
error("Default dict must be <: Associative{K,V}")

DefaultDictBase(x::F, kv::AbstractArray{(K,V)}) = (check_D(D,K,V); new(x, D(kv)))
DefaultDictBase(x::F, d::DefaultDictBase) = (check_D(D,K,V); DefaultDictBase(x, d.d))
DefaultDictBase(x::F, d::D=D()) = (check_D(D,K,V); new(x, d))
DefaultDictBase(x, ks, vs) = (check_D(D,K,V); new(x, D(ks,vs)))
end

# Constructors
Expand Down

0 comments on commit 63a9266

Please sign in to comment.