Skip to content

Commit 6a2d98d

Browse files
committed
Use new where syntax in misc files
1 parent 2e89bc1 commit 6a2d98d

22 files changed

+91
-91
lines changed

base/abstractarray.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -509,14 +509,14 @@ julia> similar(falses(10), Float64, 2, 4)
509509
```
510510
511511
"""
512-
similar{T}(a::AbstractArray{T}) = similar(a, T)
513-
similar{T}(a::AbstractArray, ::Type{T}) = similar(a, T, to_shape(indices(a)))
514-
similar{T}(a::AbstractArray{T}, dims::Tuple) = similar(a, T, to_shape(dims))
515-
similar{T}(a::AbstractArray{T}, dims::DimOrInd...) = similar(a, T, to_shape(dims))
516-
similar{T}(a::AbstractArray, ::Type{T}, dims::DimOrInd...) = similar(a, T, to_shape(dims))
517-
similar{T}(a::AbstractArray, ::Type{T}, dims::NeedsShaping) = similar(a, T, to_shape(dims))
512+
similar(a::AbstractArray{T}) where {T} = similar(a, T)
513+
similar(a::AbstractArray, ::Type{T}) where {T} = similar(a, T, to_shape(indices(a)))
514+
similar(a::AbstractArray{T}, dims::Tuple) where {T} = similar(a, T, to_shape(dims))
515+
similar(a::AbstractArray{T}, dims::DimOrInd...) where {T} = similar(a, T, to_shape(dims))
516+
similar(a::AbstractArray, ::Type{T}, dims::DimOrInd...) where {T} = similar(a, T, to_shape(dims))
517+
similar(a::AbstractArray, ::Type{T}, dims::NeedsShaping) where {T} = similar(a, T, to_shape(dims))
518518
# similar creates an Array by default
519-
similar{T,N}(a::AbstractArray, ::Type{T}, dims::Dims{N}) = Array{T,N}(dims)
519+
similar(a::AbstractArray, ::Type{T}, dims::Dims{N}) where {T,N} = Array{T,N}(dims)
520520

521521
to_shape(::Tuple{}) = ()
522522
to_shape(dims::Dims) = dims
@@ -841,10 +841,10 @@ full(x::AbstractArray) = x
841841

842842
## range conversions ##
843843

844-
map{T<:Real}(::Type{T}, r::StepRange) = T(r.start):T(r.step):T(last(r))
845-
map{T<:Real}(::Type{T}, r::UnitRange) = T(r.start):T(last(r))
846-
map{T<:AbstractFloat}(::Type{T}, r::StepRangeLen) = convert(StepRangeLen{T}, r)
847-
function map{T<:AbstractFloat}(::Type{T}, r::LinSpace)
844+
map(::Type{T}, r::StepRange) where {T<:Real} = T(r.start):T(r.step):T(last(r))
845+
map(::Type{T}, r::UnitRange) where {T<:Real} = T(r.start):T(last(r))
846+
map(::Type{T}, r::StepRangeLen) where {T<:AbstractFloat} = convert(StepRangeLen{T}, r)
847+
function map(::Type{T}, r::LinSpace) where T<:AbstractFloat
848848
LinSpace(T(r.start), T(r.stop), length(r))
849849
end
850850

@@ -1847,7 +1847,7 @@ end
18471847

18481848
## 1 argument
18491849

1850-
function map!{F}(f::F, dest::AbstractArray, A::AbstractArray)
1850+
function map!(f::F, dest::AbstractArray, A::AbstractArray) where F
18511851
for (i,j) in zip(eachindex(dest),eachindex(A))
18521852
dest[i] = f(A[j])
18531853
end
@@ -1881,7 +1881,7 @@ julia> map(+, [1, 2, 3], [10, 20, 30])
18811881
map(f, A) = collect(Generator(f,A))
18821882

18831883
## 2 argument
1884-
function map!{F}(f::F, dest::AbstractArray, A::AbstractArray, B::AbstractArray)
1884+
function map!(f::F, dest::AbstractArray, A::AbstractArray, B::AbstractArray) where F
18851885
for (i, j, k) in zip(eachindex(dest), eachindex(A), eachindex(B))
18861886
dest[i] = f(A[j], B[k])
18871887
end
@@ -1918,7 +1918,7 @@ julia> x
19181918
6.0
19191919
```
19201920
"""
1921-
map!{F}(f::F, dest::AbstractArray, As::AbstractArray...) = map_n!(f, dest, As)
1921+
map!(f::F, dest::AbstractArray, As::AbstractArray...) where {F} = map_n!(f, dest, As)
19221922

19231923
map(f) = f()
19241924
map(f, iters...) = collect(Generator(f, iters...))

base/array.jl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,20 @@ copy!{T}(dest::Array{T}, src::Array{T}) = copy!(dest, 1, src, 1, length(src))
125125

126126
copy{T<:Array}(a::T) = ccall(:jl_array_copy, Ref{T}, (Any,), a)
127127

128-
function reinterpret{T,S}(::Type{T}, a::Array{S,1})
128+
function reinterpret(::Type{T}, a::Array{S,1}) where T where S
129129
nel = Int(div(length(a)*sizeof(S),sizeof(T)))
130130
# TODO: maybe check that remainder is zero?
131131
return reinterpret(T, a, (nel,))
132132
end
133133

134-
function reinterpret{T,S}(::Type{T}, a::Array{S})
134+
function reinterpret(::Type{T}, a::Array{S}) where T where S
135135
if sizeof(S) != sizeof(T)
136136
throw(ArgumentError("result shape not specified"))
137137
end
138138
reinterpret(T, a, size(a))
139139
end
140140

141-
function reinterpret{T,S,N}(::Type{T}, a::Array{S}, dims::NTuple{N,Int})
141+
function reinterpret(::Type{T}, a::Array{S}, dims::NTuple{N,Int}) where T where S where N
142142
if !isbits(T)
143143
throw(ArgumentError("cannot reinterpret Array{$(S)} to ::Type{Array{$(T)}}, type $(T) is not a bits type"))
144144
end
@@ -173,13 +173,13 @@ end
173173

174174
## Constructors ##
175175

176-
similar{T}(a::Array{T,1}) = Array{T,1}(size(a,1))
177-
similar{T}(a::Array{T,2}) = Array{T,2}(size(a,1), size(a,2))
178-
similar{T}(a::Array{T,1}, S::Type) = Array{S,1}(size(a,1))
179-
similar{T}(a::Array{T,2}, S::Type) = Array{S,2}(size(a,1), size(a,2))
180-
similar{T}(a::Array{T}, m::Int) = Array{T,1}(m)
181-
similar{N}(a::Array, T::Type, dims::Dims{N}) = Array{T,N}(dims)
182-
similar{T,N}(a::Array{T}, dims::Dims{N}) = Array{T,N}(dims)
176+
similar(a::Array{T,1}) where {T} = Array{T,1}(size(a,1))
177+
similar(a::Array{T,2}) where {T} = Array{T,2}(size(a,1), size(a,2))
178+
similar(a::Array{T,1}, S::Type) where {T} = Array{S,1}(size(a,1))
179+
similar(a::Array{T,2}, S::Type) where {T} = Array{S,2}(size(a,1), size(a,2))
180+
similar(a::Array{T}, m::Int) where {T} = Array{T,1}(m)
181+
similar(a::Array, T::Type, dims::Dims{N}) where {N} = Array{T,N}(dims)
182+
similar(a::Array{T}, dims::Dims{N}) where {T,N} = Array{T,N}(dims)
183183

184184
# T[x...] constructs Array{T,1}
185185
function getindex{T}(::Type{T}, vals...)
@@ -209,7 +209,7 @@ function fill!(a::Union{Array{UInt8}, Array{Int8}}, x::Integer)
209209
return a
210210
end
211211

212-
function fill!{T<:Union{Integer,AbstractFloat}}(a::Array{T}, x)
212+
function fill!(a::Array{T}, x) where T<:Union{Integer,AbstractFloat}
213213
xT = convert(T, x)
214214
for i in eachindex(a)
215215
@inbounds a[i] = xT
@@ -533,8 +533,8 @@ function getindex{S}(A::Array{S}, I::Range{Int})
533533
end
534534

535535
## Indexing: setindex! ##
536-
setindex!{T}(A::Array{T}, x, i1::Int) = arrayset(A, convert(T,x)::T, i1)
537-
setindex!{T}(A::Array{T}, x, i1::Int, i2::Int, I::Int...) = (@_inline_meta; arrayset(A, convert(T,x)::T, i1, i2, I...)) # TODO: REMOVE FOR #14770
536+
setindex!(A::Array{T}, x, i1::Int) where {T} = arrayset(A, convert(T,x)::T, i1)
537+
setindex!(A::Array{T}, x, i1::Int, i2::Int, I::Int...) where {T} = (@_inline_meta; arrayset(A, convert(T,x)::T, i1, i2, I...)) # TODO: REMOVE FOR #14770
538538

539539
# These are redundant with the abstract fallbacks but needed for bootstrap
540540
function setindex!(A::Array, x, I::AbstractVector{Int})
@@ -564,7 +564,7 @@ function setindex!(A::Array, X::AbstractArray, I::AbstractVector{Int})
564564
end
565565

566566
# Faster contiguous setindex! with copy!
567-
function setindex!{T}(A::Array{T}, X::Array{T}, I::UnitRange{Int})
567+
function setindex!(A::Array{T}, X::Array{T}, I::UnitRange{Int}) where T
568568
@_inline_meta
569569
@boundscheck checkbounds(A, I)
570570
lI = length(I)
@@ -574,7 +574,7 @@ function setindex!{T}(A::Array{T}, X::Array{T}, I::UnitRange{Int})
574574
end
575575
return A
576576
end
577-
function setindex!{T}(A::Array{T}, X::Array{T}, c::Colon)
577+
function setindex!(A::Array{T}, X::Array{T}, c::Colon) where T
578578
@_inline_meta
579579
lI = length(A)
580580
@boundscheck setindex_shape_check(X, lI)
@@ -585,7 +585,7 @@ function setindex!{T}(A::Array{T}, X::Array{T}, c::Colon)
585585
end
586586

587587
setindex!(A::Array, x::Number, ::Colon) = fill!(A, x)
588-
setindex!{T, N}(A::Array{T, N}, x::Number, ::Vararg{Colon, N}) = fill!(A, x)
588+
setindex!(A::Array{T, N}, x::Number, ::Vararg{Colon, N}) where {T, N} = fill!(A, x)
589589

590590
# efficiently grow an array
591591

base/atomics.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ julia> x[]
303303
function atomic_min! end
304304

305305
unsafe_convert{T}(::Type{Ptr{T}}, x::Atomic{T}) = convert(Ptr{T}, pointer_from_objref(x))
306-
setindex!{T}(x::Atomic{T}, v) = setindex!(x, convert(T, v))
306+
setindex!(x::Atomic{T}, v) where {T} = setindex!(x, convert(T, v))
307307

308308
const llvmtypes = Dict(
309309
Bool => "i1",
@@ -316,13 +316,13 @@ const llvmtypes = Dict(
316316
Float32 => "float",
317317
Float64 => "double",
318318
)
319-
inttype{T<:Integer}(::Type{T}) = T
319+
inttype(::Type{T}) where {T<:Integer} = T
320320
inttype(::Type{Float16}) = Int16
321321
inttype(::Type{Float32}) = Int32
322322
inttype(::Type{Float64}) = Int64
323323

324324

325-
alignment{T}(::Type{T}) = ccall(:jl_alignment, Cint, (Csize_t,), sizeof(T))
325+
alignment(::Type{T}) where {T} = ccall(:jl_alignment, Cint, (Csize_t,), sizeof(T))
326326

327327
# All atomic operations have acquire and/or release semantics, depending on
328328
# whether the load or store values. Most of the time, this is what one wants

base/bitarray.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,8 @@ end
534534
convert{N}(::Type{BitArray{N}}, B::BitArray{N}) = B
535535
convert{T,N}(::Type{AbstractArray{T,N}}, B::BitArray{N}) = convert(Array{T,N}, B)
536536

537-
reinterpret{N}(::Type{Bool}, B::BitArray, dims::NTuple{N,Int}) = reinterpret(B, dims)
538-
reinterpret{N}(B::BitArray, dims::NTuple{N,Int}) = reshape(B, dims)
537+
reinterpret(::Type{Bool}, B::BitArray, dims::NTuple{N,Int}) where {N} = reinterpret(B, dims)
538+
reinterpret(B::BitArray, dims::NTuple{N,Int}) where {N} = reshape(B, dims)
539539

540540
## Constructors from generic iterables ##
541541

base/channels.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ mutable struct ChannelIterState{T}
390390
ChannelIterState{T}(has::Bool) where {T} = new(has)
391391
end
392392

393-
start{T}(c::Channel{T}) = ChannelIterState{T}(false)
393+
start(c::Channel{T}) where {T} = ChannelIterState{T}(false)
394394
function done(c::Channel, state::ChannelIterState)
395395
try
396396
# we are waiting either for more data or channel to be closed

base/deprecated.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ last{T}(r::Use_StepRangeLen_Instead{T}) = convert(T, (r.start + (r.len-1)*r.step
11961196

11971197
start(r::Use_StepRangeLen_Instead) = 0
11981198
done(r::Use_StepRangeLen_Instead, i::Int) = length(r) <= i
1199-
next{T}(r::Use_StepRangeLen_Instead{T}, i::Int) =
1199+
next(r::Use_StepRangeLen_Instead{T}, i::Int) where {T} =
12001200
(convert(T, (r.start + i*r.step)/r.divisor), i+1)
12011201

12021202
function getindex{T}(r::Use_StepRangeLen_Instead{T}, i::Integer)

base/dict.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ function grow_to!{K,V}(dest::Associative{K,V}, itr, st)
189189
return dest
190190
end
191191

192-
similar{K,V}(d::Dict{K,V}) = Dict{K,V}()
193-
similar{K,V}(d::Dict, ::Type{Pair{K,V}}) = Dict{K,V}()
192+
similar(d::Dict{K,V}) where {K,V} = Dict{K,V}()
193+
similar(d::Dict, ::Type{Pair{K,V}}) where {K,V} = Dict{K,V}()
194194

195195
# conversion between Dict types
196196
function convert{K,V}(::Type{Dict{K,V}},d::Associative)
@@ -408,15 +408,15 @@ function _setindex!(h::Dict, v, key, index)
408408
end
409409
end
410410

411-
function setindex!{K,V}(h::Dict{K,V}, v0, key0)
411+
function setindex!(h::Dict{K,V}, v0, key0) where V where K
412412
key = convert(K, key0)
413413
if !isequal(key, key0)
414414
throw(ArgumentError("$key0 is not a valid key for type $K"))
415415
end
416416
setindex!(h, v0, key)
417417
end
418418

419-
function setindex!{K,V}(h::Dict{K,V}, v0, key::K)
419+
function setindex!(h::Dict{K,V}, v0, key::K) where V where K
420420
v = convert(V, v0)
421421
index = ht_keyindex2(h, key)
422422

@@ -576,7 +576,7 @@ function start(t::Dict)
576576
return i
577577
end
578578
done(t::Dict, i) = i > length(t.vals)
579-
next{K,V}(t::Dict{K,V}, i) = (Pair{K,V}(t.keys[i],t.vals[i]), skip_deleted(t,i+1))
579+
next(t::Dict{K,V}, i) where {K,V} = (Pair{K,V}(t.keys[i],t.vals[i]), skip_deleted(t,i+1))
580580

581581
isempty(t::Dict) = (t.count == 0)
582582
length(t::Dict) = t.count
@@ -660,7 +660,7 @@ end
660660

661661
# this actually defines reverse iteration (e.g. it should not be used for merge/copy/filter type operations)
662662
start(t::ImmutableDict) = t
663-
next{K,V}(::ImmutableDict{K,V}, t) = (Pair{K,V}(t.key, t.value), t.parent)
663+
next(::ImmutableDict{K,V}, t) where {K,V} = (Pair{K,V}(t.key, t.value), t.parent)
664664
done(::ImmutableDict, t) = !isdefined(t, :parent)
665665
length(t::ImmutableDict) = count(x->true, t)
666666
isempty(t::ImmutableDict) = done(t, start(t))

base/essentials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ unsafe_convert{T}(::Type{T}, x::T) = x # unsafe_convert (like convert) defaults
153153
unsafe_convert{T<:Ptr}(::Type{T}, x::T) = x # to resolve ambiguity with the next method
154154
unsafe_convert{P<:Ptr}(::Type{P}, x::Ptr) = convert(P, x)
155155

156-
reinterpret{T}(::Type{T}, x) = bitcast(T, x)
156+
reinterpret(::Type{T}, x) where {T} = bitcast(T, x)
157157
reinterpret(::Type{Unsigned}, x::Float16) = reinterpret(UInt16,x)
158158
reinterpret(::Type{Signed}, x::Float16) = reinterpret(Int16,x)
159159

base/linalg/bidiag.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ convert{T}(::Type{AbstractMatrix{T}}, A::Bidiagonal) = convert(Bidiagonal{T}, A)
218218

219219
broadcast(::typeof(big), B::Bidiagonal) = Bidiagonal(big.(B.dv), big.(B.ev), B.isupper)
220220

221-
similar{T}(B::Bidiagonal, ::Type{T}) = Bidiagonal{T}(similar(B.dv, T), similar(B.ev, T), B.isupper)
221+
similar(B::Bidiagonal, ::Type{T}) where {T} = Bidiagonal{T}(similar(B.dv, T), similar(B.ev, T), B.isupper)
222222

223223
###################
224224
# LAPACK routines #

base/linalg/diagonal.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ convert(::Type{Matrix}, D::Diagonal) = diagm(D.diag)
5555
convert(::Type{Array}, D::Diagonal) = convert(Matrix, D)
5656
full(D::Diagonal) = convert(Array, D)
5757

58-
function similar{T}(D::Diagonal, ::Type{T})
58+
function similar(D::Diagonal, ::Type{T}) where T
5959
return Diagonal{T}(similar(D.diag, T))
6060
end
6161

base/linalg/symmetric.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ function setindex!(A::Hermitian, v, i::Integer, j::Integer)
114114
end
115115
end
116116

117-
similar{T}(A::Symmetric, ::Type{T}) = Symmetric(similar(A.data, T))
117+
similar(A::Symmetric, ::Type{T}) where {T} = Symmetric(similar(A.data, T))
118118
# Hermitian version can be simplified when check for imaginary part of
119119
# diagonal in Hermitian has been removed
120-
function similar{T}(A::Hermitian, ::Type{T})
120+
function similar(A::Hermitian, ::Type{T}) where T
121121
B = similar(A.data, T)
122122
for i = 1:size(A,1)
123123
B[i,i] = 0

base/linalg/tridiag.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function size(A::SymTridiagonal, d::Integer)
9393
end
9494
end
9595

96-
similar{T}(S::SymTridiagonal, ::Type{T}) = SymTridiagonal{T}(similar(S.dv, T), similar(S.ev, T))
96+
similar(S::SymTridiagonal, ::Type{T}) where {T} = SymTridiagonal{T}(similar(S.dv, T), similar(S.ev, T))
9797

9898
#Elementary operations
9999
broadcast(::typeof(abs), M::SymTridiagonal) = SymTridiagonal(abs.(M.dv), abs.(M.ev))
@@ -499,7 +499,7 @@ end
499499
convert{T}(::Type{Matrix}, M::Tridiagonal{T}) = convert(Matrix{T}, M)
500500
convert(::Type{Array}, M::Tridiagonal) = convert(Matrix, M)
501501
full(M::Tridiagonal) = convert(Array, M)
502-
function similar{T}(M::Tridiagonal, ::Type{T})
502+
function similar(M::Tridiagonal, ::Type{T}) where T
503503
Tridiagonal{T}(similar(M.dl, T), similar(M.d, T), similar(M.du, T), similar(M.du2, T))
504504
end
505505

base/multidimensional.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ end
784784

785785
### from abstractarray.jl
786786

787-
function fill!{T}(A::AbstractArray{T}, x)
787+
function fill!(A::AbstractArray{T}, x) where T
788788
xT = convert(T, x)
789789
for I in eachindex(A)
790790
@inbounds A[I] = xT

base/nullable.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ implementation detail, but typically the choice that maximizes performance
277277
would be used. If `x` has a value, then the return type is guaranteed to be of
278278
type `Nullable{typeof(f(x))}`.
279279
"""
280-
function map{T}(f, x::Nullable{T})
280+
function map(f, x::Nullable{T}) where T
281281
S = promote_op(f, T)
282282
if isleaftype(S) && null_safe_op(f, T)
283283
Nullable(f(unsafe_get(x)), !isnull(x))

base/range.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -432,21 +432,21 @@ function next(r::LinSpace, i::Int)
432432
end
433433

434434
start(r::StepRange) = oftype(r.start + r.step, r.start)
435-
next{T}(r::StepRange{T}, i) = (convert(T,i), i+r.step)
435+
next(r::StepRange{T}, i) where {T} = (convert(T,i), i+r.step)
436436
done(r::StepRange, i) = isempty(r) | (i < min(r.start, r.stop)) | (i > max(r.start, r.stop))
437437
done(r::StepRange, i::Integer) =
438438
isempty(r) | (i == oftype(i, r.stop) + r.step)
439439

440440
# see also twiceprecision.jl
441441
start(r::StepRangeLen) = (unsafe_getindex(r, 1), 1)
442-
next{T}(r::StepRangeLen{T}, s) = s[1], (T(s[1]+r.step), s[2]+1)
442+
next(r::StepRangeLen{T}, s) where {T} = s[1], (T(s[1]+r.step), s[2]+1)
443443
done(r::StepRangeLen, s) = s[2] > length(r)
444444

445-
start{T}(r::UnitRange{T}) = oftype(r.start + oneunit(T), r.start)
446-
next{T}(r::AbstractUnitRange{T}, i) = (convert(T, i), i + oneunit(T))
447-
done{T}(r::AbstractUnitRange{T}, i) = i == oftype(i, r.stop) + oneunit(T)
445+
start(r::UnitRange{T}) where {T} = oftype(r.start + oneunit(T), r.start)
446+
next(r::AbstractUnitRange{T}, i) where {T} = (convert(T, i), i + oneunit(T))
447+
done(r::AbstractUnitRange{T}, i) where {T} = i == oftype(i, r.stop) + oneunit(T)
448448

449-
start{T}(r::OneTo{T}) = oneunit(T)
449+
start(r::OneTo{T}) where {T} = oneunit(T)
450450

451451
# some special cases to favor default Int type to avoid overflow
452452
let smallint = (Int === Int64 ?
@@ -455,9 +455,9 @@ let smallint = (Int === Int64 ?
455455
global start
456456
global next
457457
start(r::StepRange{<:smallint}) = convert(Int, r.start)
458-
next{T<:smallint}(r::StepRange{T}, i) = (i % T, i + r.step)
458+
next(r::StepRange{T}, i) where {T<:smallint} = (i % T, i + r.step)
459459
start(r::UnitRange{<:smallint}) = convert(Int, r.start)
460-
next{T<:smallint}(r::AbstractUnitRange{T}, i) = (i % T, i + 1)
460+
next(r::AbstractUnitRange{T}, i) where {T<:smallint} = (i % T, i + 1)
461461
start(r::OneTo{<:smallint}) = 1
462462
end
463463

base/reshapedarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ similar(A::ReshapedArray, eltype::Type, dims::Dims) = similar(parent(A), eltype,
168168
IndexStyle(::Type{<:ReshapedArrayLF}) = IndexLinear()
169169
parent(A::ReshapedArray) = A.parent
170170
parentindexes(A::ReshapedArray) = map(s->1:s, size(parent(A)))
171-
reinterpret{T}(::Type{T}, A::ReshapedArray, dims::Dims) = reinterpret(T, parent(A), dims)
171+
reinterpret(::Type{T}, A::ReshapedArray, dims::Dims) where {T} = reinterpret(T, parent(A), dims)
172172

173173
@inline ind2sub_rs(::Tuple{}, i::Int) = i
174174
@inline ind2sub_rs(strds, i) = ind2sub_rs((), strds, i-1)

base/set.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function Set(g::Generator)
1515
end
1616

1717
eltype{T}(::Type{Set{T}}) = T
18-
similar{T}(s::Set{T}) = Set{T}()
18+
similar(s::Set{T}) where {T} = Set{T}()
1919
similar(s::Set, T::Type) = Set{T}()
2020

2121
function show(io::IO, s::Set)

0 commit comments

Comments
 (0)