Skip to content

Commit

Permalink
replace Union( ) with Union{ } everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jun 15, 2015
1 parent 126763e commit d05a579
Show file tree
Hide file tree
Showing 109 changed files with 505 additions and 505 deletions.
10 changes: 5 additions & 5 deletions base/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ end
# source is the keymap specified by the user (with normalized keys)
function keymap_merge(target,source)
ret = copy(target)
direct_keys = filter((k,v) -> isa(v, Union(Function, KeyAlias, Void)), source)
direct_keys = filter((k,v) -> isa(v, Union{Function, KeyAlias, Void}), source)
# first direct entries
for key in keys(direct_keys)
add_nested_key!(ret, key, source[key]; override = true)
Expand All @@ -890,7 +890,7 @@ function keymap_merge(target,source)
# We first resolve redirects in the source
value = source[key]
visited = Array(Any,0)
while isa(value, Union(Char,AbstractString))
while isa(value, Union{Char,AbstractString})
value = normalize_key(value)
if value in visited
error("Eager redirection cycle detected for key " * escape_string(key))
Expand All @@ -902,7 +902,7 @@ function keymap_merge(target,source)
value = source[value]
end

if isa(value, Union(Char,AbstractString))
if isa(value, Union{Char,AbstractString})
value = getEntry(ret, value)
if value === nothing
error("Could not find redirected value " * escape_string(source[key]))
Expand Down Expand Up @@ -1265,8 +1265,8 @@ function setup_search_keymap(hp)
(p, skeymap)
end

keymap(state, p::Union(HistoryPrompt,PrefixHistoryPrompt)) = p.keymap_dict
keymap_data(state, ::Union(HistoryPrompt, PrefixHistoryPrompt)) = state
keymap(state, p::Union{HistoryPrompt,PrefixHistoryPrompt}) = p.keymap_dict
keymap_data(state, ::Union{HistoryPrompt, PrefixHistoryPrompt}) = state

Base.isempty(s::PromptState) = s.input_buffer.size == 0

Expand Down
2 changes: 1 addition & 1 deletion base/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ function add_history(hist::REPLHistoryProvider, s)
flush(hist.history_file)
end

function history_move(s::Union(LineEdit.MIState,LineEdit.PrefixSearchState), hist::REPLHistoryProvider, idx::Int, save_idx::Int = hist.cur_idx)
function history_move(s::Union{LineEdit.MIState,LineEdit.PrefixSearchState}, hist::REPLHistoryProvider, idx::Int, save_idx::Int = hist.cur_idx)
max_idx = length(hist.history) + 1
@assert 1 <= hist.cur_idx <= max_idx
(1 <= idx <= max_idx) || return :none
Expand Down
4 changes: 2 additions & 2 deletions base/REPLCompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function complete_symbol(sym, ffunc)

mod = context_module
lookup_module = true
t = Union()
t = Union{}
for name in strs[1:(end-1)]
s = symbol(name)
if lookup_module
Expand Down Expand Up @@ -237,7 +237,7 @@ function complete_methods(ex_org::Expr)
t_in = Tuple{args_ex...} # Input types
for method in methods(func)
# Check if the method's type signature intersects the input types
typeintersect(Tuple{method.sig.parameters[1 : min(length(args_ex), end)]...}, t_in) != Union() &&
typeintersect(Tuple{method.sig.parameters[1 : min(length(args_ex), end)]...}, t_in) != Union{} &&
push!(out,string(method))
end
return out
Expand Down
14 changes: 7 additions & 7 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

typealias AbstractVector{T} AbstractArray{T,1}
typealias AbstractMatrix{T} AbstractArray{T,2}
typealias AbstractVecOrMat{T} Union(AbstractVector{T}, AbstractMatrix{T})
typealias RangeIndex Union(Int, Range{Int}, UnitRange{Int}, Colon)
typealias AbstractVecOrMat{T} Union{AbstractVector{T}, AbstractMatrix{T}}
typealias RangeIndex Union{Int, Range{Int}, UnitRange{Int}, Colon}

## Basic functions ##

Expand Down Expand Up @@ -151,15 +151,15 @@ throw_boundserror(A, I) = (@_noinline_meta; throw(BoundsError(A, I)))
checkbounds(A::AbstractArray, I::AbstractArray{Bool}) = size(A) == size(I) || throw_boundserror(A, I)
checkbounds(A::AbstractArray, I::AbstractVector{Bool}) = length(A) == length(I) || throw_boundserror(A, I)
checkbounds(A::AbstractArray, I) = (@_inline_meta; _checkbounds(length(A), I) || throw_boundserror(A, I))
function checkbounds(A::AbstractMatrix, I::Union(Real,AbstractArray,Colon), J::Union(Real,AbstractArray,Colon))
function checkbounds(A::AbstractMatrix, I::Union{Real,AbstractArray,Colon}, J::Union{Real,AbstractArray,Colon})
@_inline_meta
(_checkbounds(size(A,1), I) && _checkbounds(size(A,2), J)) || throw_boundserror(A, (I, J))
end
function checkbounds(A::AbstractArray, I::Union(Real,AbstractArray,Colon), J::Union(Real,AbstractArray,Colon))
function checkbounds(A::AbstractArray, I::Union{Real,AbstractArray,Colon}, J::Union{Real,AbstractArray,Colon})
@_inline_meta
(_checkbounds(size(A,1), I) && _checkbounds(trailingsize(A,Val{2}), J)) || throw_boundserror(A, (I, J))
end
@generated function checkbounds(A::AbstractArray, I::Union(Real,AbstractArray,Colon)...)
@generated function checkbounds(A::AbstractArray, I::Union{Real,AbstractArray,Colon}...)
meta = Expr(:meta, :inline)
N = length(I)
args = Expr[:(_checkbounds(size(A,$dim), I[$dim]) || throw_boundserror(A, I)) for dim in 1:N-1]
Expand Down Expand Up @@ -599,13 +599,13 @@ end

## get (getindex with a default value) ##

typealias RangeVecIntList{A<:AbstractVector{Int}} Union(Tuple{Vararg{Union(Range, AbstractVector{Int})}}, AbstractVector{UnitRange{Int}}, AbstractVector{Range{Int}}, AbstractVector{A})
typealias RangeVecIntList{A<:AbstractVector{Int}} Union{Tuple{Vararg{Union{Range, AbstractVector{Int}}}}, AbstractVector{UnitRange{Int}}, AbstractVector{Range{Int}}, AbstractVector{A}}

get(A::AbstractArray, i::Integer, default) = in_bounds(length(A), i) ? A[i] : default
get(A::AbstractArray, I::Tuple{}, default) = similar(A, typeof(default), 0)
get(A::AbstractArray, I::Dims, default) = in_bounds(size(A), I...) ? A[I...] : default

function get!{T}(X::AbstractArray{T}, A::AbstractArray, I::Union(Range, AbstractVector{Int}), default::T)
function get!{T}(X::AbstractArray{T}, A::AbstractArray, I::Union{Range, AbstractVector{Int}}, default::T)
ind = findin(I, 1:length(A))
X[ind] = A[I[ind]]
X[1:first(ind)-1] = default
Expand Down
16 changes: 8 additions & 8 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

typealias Vector{T} Array{T,1}
typealias Matrix{T} Array{T,2}
typealias VecOrMat{T} Union(Vector{T}, Matrix{T})
typealias VecOrMat{T} Union{Vector{T}, Matrix{T}}

typealias DenseVector{T} DenseArray{T,1}
typealias DenseMatrix{T} DenseArray{T,2}
typealias DenseVecOrMat{T} Union(DenseVector{T}, DenseMatrix{T})
typealias DenseVecOrMat{T} Union{DenseVector{T}, DenseMatrix{T}}

call{T}(::Type{Vector{T}}, m::Integer) = Array{T}(m)
call{T}(::Type{Vector{T}}) = Array{T}(0)
Expand Down Expand Up @@ -42,8 +42,8 @@ function call{P<:Ptr,T}(::Type{Ref{P}}, a::Array{T}) # Ref{P<:Ptr}(a::Array)
return RefArray(ptrs,1,roots)
end
end
cconvert{P<:Ptr,T<:Ptr}(::Union(Type{Ptr{P}},Type{Ref{P}}), a::Array{T}) = a
cconvert{P<:Ptr}(::Union(Type{Ptr{P}},Type{Ref{P}}), a::Array) = Ref{P}(a)
cconvert{P<:Ptr,T<:Ptr}(::Union{Type{Ptr{P}},Type{Ref{P}}}, a::Array{T}) = a
cconvert{P<:Ptr}(::Union{Type{Ptr{P}},Type{Ref{P}}}, a::Array) = Ref{P}(a)

size(a::Array, d) = arraysize(a, d)
size(a::Vector) = (arraysize(a,1),)
Expand Down Expand Up @@ -179,12 +179,12 @@ end

if _oldstyle_array_vcat_
# T[a:b] and T[a:s:b] also construct typed ranges
function getindex{T<:Union(Char,Number)}(::Type{T}, r::Range)
function getindex{T<:Union{Char,Number}}(::Type{T}, r::Range)
depwarn("T[a:b] concatenation is deprecated; use T[a:b;] instead", :getindex)
copy!(Array(T,length(r)), r)
end

function getindex{T<:Union(Char,Number)}(::Type{T}, r1::Range, rs::Range...)
function getindex{T<:Union{Char,Number}}(::Type{T}, r1::Range, rs::Range...)
depwarn("T[a:b,...] concatenation is deprecated; use T[a:b;...] instead", :getindex)
a = Array(T,length(r1)+sum(length,rs))
o = 1
Expand All @@ -198,12 +198,12 @@ function getindex{T<:Union(Char,Number)}(::Type{T}, r1::Range, rs::Range...)
end
end #_oldstyle_array_vcat_

function fill!(a::Union(Array{UInt8}, Array{Int8}), x::Integer)
function fill!(a::Union{Array{UInt8}, Array{Int8}}, x::Integer)
ccall(:memset, Ptr{Void}, (Ptr{Void}, Cint, Csize_t), a, x, length(a))
return a
end

function fill!{T<:Union(Integer,FloatingPoint)}(a::Array{T}, x)
function fill!{T<:Union{Integer,FloatingPoint}}(a::Array{T}, x)
# note: checking bit pattern
xT = convert(T,x)
if isbits(T) && nfields(T)==0 &&
Expand Down
10 changes: 5 additions & 5 deletions base/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ end

const _default_bit_splice = BitVector(0)

function splice!(B::BitVector, r::Union(UnitRange{Int}, Integer), ins::AbstractArray = _default_bit_splice)
function splice!(B::BitVector, r::Union{UnitRange{Int}, Integer}, ins::AbstractArray = _default_bit_splice)
n = length(B)
i_f = first(r)
i_l = last(r)
Expand Down Expand Up @@ -758,7 +758,7 @@ function splice!(B::BitVector, r::Union(UnitRange{Int}, Integer), ins::AbstractA
return v
end

function splice!(B::BitVector, r::Union(UnitRange{Int}, Integer), ins)
function splice!(B::BitVector, r::Union{UnitRange{Int}, Integer}, ins)
Bins = BitArray(length(ins))
i = 1
for x in ins
Expand Down Expand Up @@ -1618,7 +1618,7 @@ ctranspose(B::BitArray) = transpose(B)

## Permute array dims ##

function permutedims(B::Union(BitArray,StridedArray), perm)
function permutedims(B::Union{BitArray,StridedArray}, perm)
dimsB = size(B)
ndimsB = length(dimsB)
(ndimsB == length(perm) && isperm(perm)) || throw(ArgumentError("no valid permutation of dimensions"))
Expand Down Expand Up @@ -1658,7 +1658,7 @@ function vcat(V::BitVector...)
return B
end

function hcat(A::Union(BitMatrix,BitVector)...)
function hcat(A::Union{BitMatrix,BitVector}...)
nargs = length(A)
nrows = size(A[1], 1)
ncols = 0
Expand Down Expand Up @@ -1708,7 +1708,7 @@ function vcat(A::BitMatrix...)
end

# general case, specialized for BitArrays and Integers
function cat(catdim::Integer, X::Union(BitArray, Integer)...)
function cat(catdim::Integer, X::Union{BitArray, Integer}...)
nargs = length(X)
# using integers results in conversion to Array{Int}
# (except in the all-Bool case)
Expand Down
16 changes: 8 additions & 8 deletions base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ longer_tuple(x::Tuple, retx::Tuple, y::Tuple, rety::Tuple) =
longer_tuple(droparg1(x...), retx, droparg1(y...), rety)
longer_tuple(x::Tuple, y::Tuple) = longer_tuple(x, x, y, y)

longer_size(x::Union(AbstractArray,Number)) = size(x)
longer_size(x::Union(AbstractArray,Number), y::Union(AbstractArray,Number)...) =
longer_size(x::Union{AbstractArray,Number}) = size(x)
longer_size(x::Union{AbstractArray,Number}, y::Union{AbstractArray,Number}...) =
longer_tuple(size(x), longer_size(y...))

# Calculate the broadcast shape of the arguments, or error if incompatible
broadcast_shape() = ()
function broadcast_shape(As::Union(AbstractArray,Number)...)
function broadcast_shape(As::Union{AbstractArray,Number}...)
sz = longer_size(As...)
nd = length(sz)
bshape = ones(Int, nd)
Expand All @@ -48,7 +48,7 @@ function broadcast_shape(As::Union(AbstractArray,Number)...)
end

# Check that all arguments are broadcast compatible with shape
function check_broadcast_shape(shape::Dims, As::Union(AbstractArray,Number)...)
function check_broadcast_shape(shape::Dims, As::Union{AbstractArray,Number}...)
for A in As
if ndims(A) > length(shape)
throw(DimensionMismatch("cannot broadcast array to have fewer dimensions"))
Expand Down Expand Up @@ -207,9 +207,9 @@ function gen_broadcast_function_tobitarray(genbody::Function, nd::Int, narrays::
end

for (Bsig, Asig, gbf, gbb) in
((BitArray , Union(Array,BitArray,Number) ,
((BitArray , Union{Array,BitArray,Number} ,
:gen_broadcast_function_tobitarray, :gen_broadcast_body_iter_tobitarray ),
(Any , Union(Array,BitArray,Number) ,
(Any , Union{Array,BitArray,Number} ,
:gen_broadcast_function , :gen_broadcast_body_iter ),
(BitArray , Any ,
:gen_broadcast_function_tobitarray, :gen_broadcast_body_cartesian_tobitarray),
Expand Down Expand Up @@ -318,8 +318,8 @@ function .\(A::AbstractArray, B::AbstractArray)
broadcast!(\, Array(type_div(eltype(A), eltype(B)), broadcast_shape(A, B)), A, B)
end

typealias RatIntT{T<:Integer} Union(Type{Rational{T}},Type{T})
typealias CRatIntT{T<:Integer} Union(Type{Complex{Rational{T}}},Type{Complex{T}},Type{Rational{T}},Type{T})
typealias RatIntT{T<:Integer} Union{Type{Rational{T}},Type{T}}
typealias CRatIntT{T<:Integer} Union{Type{Complex{Rational{T}}},Type{Complex{T}},Type{Rational{T}},Type{T}}
type_rdiv{T<:Integer,S<:Integer}(::RatIntT{T}, ::RatIntT{S}) =
Rational{promote_type(T,S)}
type_rdiv{T<:Integer,S<:Integer}(::CRatIntT{T}, ::CRatIntT{S}) =
Expand Down
6 changes: 3 additions & 3 deletions base/c.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ else
bitstype 32 Cwstring
end

convert{T<:Union(Int8,UInt8)}(::Type{Cstring}, p::Ptr{T}) = box(Cstring, unbox(Ptr{T}, p))
convert{T<:Union{Int8,UInt8}}(::Type{Cstring}, p::Ptr{T}) = box(Cstring, unbox(Ptr{T}, p))
convert(::Type{Cwstring}, p::Ptr{Cwchar_t}) = box(Cwstring, unbox(Ptr{Cwchar_t}, p))

# convert strings to ByteString etc. to pass as pointers
Expand Down Expand Up @@ -91,11 +91,11 @@ sigatomic_end() = ccall(:jl_sigatomic_end, Void, ())
disable_sigint(f::Function) = try sigatomic_begin(); f(); finally sigatomic_end(); end
reenable_sigint(f::Function) = try sigatomic_end(); f(); finally sigatomic_begin(); end

function ccallable(f::Function, rt::Type, argt::Type, name::Union(AbstractString,Symbol)=string(f))
function ccallable(f::Function, rt::Type, argt::Type, name::Union{AbstractString,Symbol}=string(f))
ccall(:jl_extern_c, Void, (Any, Any, Any, Cstring), f, rt, argt, name)
end

function ccallable(f::Function, argt::Type, name::Union(AbstractString,Symbol)=string(f))
function ccallable(f::Function, argt::Type, name::Union{AbstractString,Symbol}=string(f))
ccall(:jl_extern_c, Void, (Any, Ptr{Void}, Any, Cstring), f, C_NULL, argt, name)
end

Expand Down
2 changes: 1 addition & 1 deletion base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ function _start()
global active_repl_backend
if repl
if !isa(STDIN,TTY)
global is_interactive |= !isa(STDIN,Union(File,IOStream))
global is_interactive |= !isa(STDIN,Union{File,IOStream})
color_set || (global have_color = false)
else
term = Terminals.TTYTerminal(get(ENV,"TERM",@windows? "" : "dumb"),STDIN,STDOUT,STDERR)
Expand Down
10 changes: 5 additions & 5 deletions base/combinatorics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ end

factorial(n::Int128) = factorial_lookup(n, _fact_table128, 33)
factorial(n::UInt128) = factorial_lookup(n, _fact_table128, 34)
factorial(n::Union(Int64,UInt64)) = factorial_lookup(n, _fact_table64, 20)
factorial(n::Union{Int64,UInt64}) = factorial_lookup(n, _fact_table64, 20)

if Int === Int32
factorial(n::Union(Int8,UInt8,Int16,UInt16)) = factorial(Int32(n))
factorial(n::Union(Int32,UInt32)) = factorial_lookup(n, _fact_table64, 12)
factorial(n::Union{Int8,UInt8,Int16,UInt16}) = factorial(Int32(n))
factorial(n::Union{Int32,UInt32}) = factorial_lookup(n, _fact_table64, 12)
else
factorial(n::Union(Int8,UInt8,Int16,UInt16,Int32,UInt32)) = factorial(Int64(n))
factorial(n::Union{Int8,UInt8,Int16,UInt16,Int32,UInt32}) = factorial(Int64(n))
end

function gamma(n::Union(Int8,UInt8,Int16,UInt16,Int32,UInt32,Int64,UInt64))
function gamma(n::Union{Int8,UInt8,Int16,UInt16,Int32,UInt32,Int64,UInt64})
n < 0 && throw(DomainError())
n == 0 && return Inf
n <= 2 && return 1.0
Expand Down
8 changes: 4 additions & 4 deletions base/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ function /{T<:Real}(a::Complex{T}, b::Complex{T})
end
end

inv{T<:Union(Float16,Float32)}(z::Complex{T}) =
inv{T<:Union{Float16,Float32}}(z::Complex{T}) =
oftype(z, conj(widen(z))/abs2(widen(z)))

/{T<:Union(Float16,Float32)}(z::Complex{T}, w::Complex{T}) =
/{T<:Union{Float16,Float32}}(z::Complex{T}, w::Complex{T}) =
oftype(z, widen(z)*inv(widen(w)))

# robust complex division for double precision
Expand Down Expand Up @@ -732,7 +732,7 @@ big{T<:Integer}(z::Complex{T}) = Complex{BigInt}(z)

complex{T<:Complex}(x::AbstractArray{T}) = x

complex{T<:Union(Integer64,Float64,Float32,Float16)}(x::AbstractArray{T}) =
complex{T<:Union{Integer64,Float64,Float32,Float16}}(x::AbstractArray{T}) =
convert(AbstractArray{typeof(complex(zero(T)))}, x)

function complex(A::AbstractArray)
Expand All @@ -745,7 +745,7 @@ big{T<:FloatingPoint,N}(x::AbstractArray{Complex{T},N}) = convert(AbstractArray{

## promotion to complex ##

promote_array_type{S<:Union(Complex, Real), AT<:FloatingPoint}(::Type{S}, ::Type{Complex{AT}}) = Complex{AT}
promote_array_type{S<:Union{Complex, Real}, AT<:FloatingPoint}(::Type{S}, ::Type{Complex{AT}}) = Complex{AT}

function complex{S<:Real,T<:Real}(A::Array{S}, B::Array{T})
if size(A) != size(B); throw(DimensionMismatch()); end
Expand Down
2 changes: 1 addition & 1 deletion base/constants.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ convert(::Type{Float16}, x::MathConst) = Float16(Float32(x))
convert{T<:Real}(::Type{Complex{T}}, x::MathConst) = convert(Complex{T}, convert(T,x))
convert{T<:Integer}(::Type{Rational{T}}, x::MathConst) = convert(Rational{T}, Float64(x))

@generated function call{T<:Union(Float32,Float64),s}(t::Type{T},c::MathConst{s},r::RoundingMode)
@generated function call{T<:Union{Float32,Float64},s}(t::Type{T},c::MathConst{s},r::RoundingMode)
f = T(big(c()),r())
:($f)
end
Expand Down
2 changes: 1 addition & 1 deletion base/coreimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ include("abstractarray.jl")
typealias StridedArray{T,N,A<:DenseArray,I<:Tuple{Vararg{RangeIndex}}} DenseArray{T,N}
typealias StridedVector{T,A<:DenseArray,I<:Tuple{Vararg{RangeIndex}}} DenseArray{T,1}
typealias StridedMatrix{T,A<:DenseArray,I<:Tuple{Vararg{RangeIndex}}} DenseArray{T,2}
typealias StridedVecOrMat{T} Union(StridedVector{T}, StridedMatrix{T})
typealias StridedVecOrMat{T} Union{StridedVector{T}, StridedMatrix{T}}
include("array.jl")

#TODO: eliminate Dict from inference
Expand Down
2 changes: 1 addition & 1 deletion base/datafmt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ const valid_opts = [:header, :has_header, :ignore_invalid_chars, :use_mmap, :quo
const valid_opt_types = [Bool, Bool, Bool, Bool, Bool, Bool, NTuple{2,Integer}, Char, Integer, Bool]
const deprecated_opts = Dict(:has_header => :header)
function val_opts(opts)
d = Dict{Symbol,Union(Bool,NTuple{2,Integer},Char,Integer)}()
d = Dict{Symbol,Union{Bool,NTuple{2,Integer},Char,Integer}}()
for (opt_name, opt_val) in opts
!in(opt_name, valid_opts) && throw(ArgumentError("unknown option $opt_name"))
opt_typ = valid_opt_types[findfirst(valid_opts, opt_name)]
Expand Down
4 changes: 2 additions & 2 deletions base/dates/adjusters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ function toprev(func::Function,dt::TimeType;step::Period=Day(-1),negate::Bool=fa
end

# Return the first TimeType that falls on dow in the Month or Year
function tofirst(dt::TimeType,dow::Int;of::Union(Type{Year},Type{Month})=Month)
function tofirst(dt::TimeType,dow::Int;of::Union{Type{Year},Type{Month}}=Month)
dt = of <: Month ? firstdayofmonth(dt) : firstdayofyear(dt)
return adjust(ISDAYOFWEEK[dow],dt,Day(1),366)
end

# Return the last TimeType that falls on dow in the Month or Year
function tolast(dt::TimeType,dow::Int;of::Union(Type{Year},Type{Month})=Month)
function tolast(dt::TimeType,dow::Int;of::Union{Type{Year},Type{Month}}=Month)
dt = of <: Month ? lastdayofmonth(dt) : lastdayofyear(dt)
return adjust(ISDAYOFWEEK[dow],dt,Day(-1),366)
end
Expand Down
Loading

0 comments on commit d05a579

Please sign in to comment.