Skip to content

Commit 42d85fe

Browse files
KristofferClbenet
authored andcommitted
fix deprecations [femtocleaner] (#99)
1 parent 170af0c commit 42d85fe

File tree

8 files changed

+49
-49
lines changed

8 files changed

+49
-49
lines changed

examples/draw_function_image.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function make_rectangle(x, y, xwidth, ywidth, color="grey", alpha=0.5)
1616
end
1717

1818
import PyPlot.draw
19-
function draw{T<:IntervalBox}(box_list::Vector{T}, color="grey", alpha=0.5)
19+
function draw(box_list::Vector{T}, color="grey", alpha=0.5) where T<:IntervalBox
2020
patch_list = []
2121
for box in box_list
2222
x, y = box

examples/standard_map.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function standard_map(X::IntervalBox, k = 1.0)
1616
IntervalBox(p′, θ′)
1717
end
1818

19-
function IntervalBox{T}(X::Vector{Interval{T}}, Y::Vector{Interval{T}})
19+
function IntervalBox(X::Vector{Interval{T}}, Y::Vector{Interval{T}}) where T
2020
vec([IntervalBox(x, y) for x in X, y in Y])
2121
end
2222

@@ -64,6 +64,6 @@ function mod(X::IntervalBox, width::Real)
6464
end
6565

6666

67-
mod2pi{T}(x::Interval{T}) = mod(x, IntervalArithmetic.two_pi(T))
67+
mod2pi(x::Interval{T}) where {T} = mod(x, IntervalArithmetic.two_pi(T))
6868

69-
mod2pi{T}(X::Vector{Interval{T}}) = vcat(map(mod2pi, X)...)
69+
mod2pi(X::Vector{Interval{T}}) where {T} = vcat(map(mod2pi, X)...)

src/intervals/rounding.jl

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,23 @@ struct IntervalRounding{T} end
3232
# Functions that are the same for all rounding types:
3333
@eval begin
3434
# unary minus:
35-
-{T<:AbstractFloat}(a::T, ::RoundingMode) = -a # ignore rounding
35+
-(a::T, ::RoundingMode) where {T<:AbstractFloat} = -a # ignore rounding
3636

3737
# zero:
38-
zero{T<:AbstractFloat}(a::Interval{T}, ::RoundingMode) = zero(T)
39-
zero{T<:AbstractFloat}(::Type{T}, ::RoundingMode) = zero(T)
38+
zero(a::Interval{T}, ::RoundingMode) where {T<:AbstractFloat} = zero(T)
39+
zero(::Type{T}, ::RoundingMode) where {T<:AbstractFloat} = zero(T)
4040

4141
convert(::Type{BigFloat}, x, rounding_mode::RoundingMode) =
4242
setrounding(BigFloat, rounding_mode) do
4343
convert(BigFloat, x)
4444
end
4545

46-
parse{T}(::Type{T}, x, rounding_mode::RoundingMode) = setrounding(T, rounding_mode) do
46+
parse(::Type{T}, x, rounding_mode::RoundingMode) where {T} = setrounding(T, rounding_mode) do
4747
parse(T, x)
4848
end
4949

5050

51-
sqrt{T<:Rational}(a::T, rounding_mode::RoundingMode) = setrounding(float(T), rounding_mode) do
51+
sqrt(a::T, rounding_mode::RoundingMode) where {T<:Rational} = setrounding(float(T), rounding_mode) do
5252
sqrt(float(a))
5353
end
5454

@@ -58,7 +58,7 @@ end
5858

5959
# no-ops for rational rounding:
6060
for f in (:+, :-, :*, :/)
61-
@eval $f{T<:Rational}(a::T, b::T, ::RoundingMode) = $f(a, b)
61+
@eval $f(a::T, b::T, ::RoundingMode) where {T<:Rational} = $f(a, b)
6262
end
6363

6464
# error-free arithmetic:
@@ -114,68 +114,68 @@ for mode in (:Down, :Up)
114114
# binary functions:
115115
for f in (:+, :-, :*, :/, :atan2)
116116

117-
@eval function $f{T<:AbstractFloat}(::IntervalRounding{:slow},
118-
a::T, b::T, $mode1)
117+
@eval function $f(::IntervalRounding{:slow},
118+
a::T, b::T, $mode1) where T<:AbstractFloat
119119
setrounding(T, $mode2) do
120120
$f(a, b)
121121
end
122122
end
123123

124-
@eval function $f{T<:AbstractFloat}(::IntervalRounding{:tight},
125-
a::T, b::T, $mode1)
124+
@eval function $f(::IntervalRounding{:tight},
125+
a::T, b::T, $mode1) where T<:AbstractFloat
126126
setrounding(T, $mode2) do
127127
$f(a, b)
128128
end
129129
end
130130

131-
@eval $f{T<:AbstractFloat}(::IntervalRounding{:accurate},
132-
a::T, b::T, $mode1) = $directed($f(a, b))
131+
@eval $f(::IntervalRounding{:accurate},
132+
a::T, b::T, $mode1) where {T<:AbstractFloat} = $directed($f(a, b))
133133

134-
@eval $f{T<:AbstractFloat}(::IntervalRounding{:none},
135-
a::T, b::T, $mode1) = $f(a, b)
134+
@eval $f(::IntervalRounding{:none},
135+
a::T, b::T, $mode1) where {T<:AbstractFloat} = $f(a, b)
136136

137137
end
138138

139139

140140
# power:
141141

142-
@eval function ^{S<:Real}(::IntervalRounding{:slow},
143-
a::BigFloat, b::S, $mode1)
142+
@eval function ^(::IntervalRounding{:slow},
143+
a::BigFloat, b::S, $mode1) where S<:Real
144144
setrounding(BigFloat, $mode2) do
145145
^(a, b)
146146
end
147147
end
148148

149149
# for correct rounding for Float64, must pass through BigFloat:
150-
@eval function ^{S<:Real}(::IntervalRounding{:slow}, a::Float64, b::S, $mode1)
150+
@eval function ^(::IntervalRounding{:slow}, a::Float64, b::S, $mode1) where S<:Real
151151
setprecision(BigFloat, 53) do
152152
Float64(^(IntervalRounding{:slow}, BigFloat(a), b, $mode2))
153153
end
154154
end
155155

156-
@eval ^{T<:AbstractFloat,S<:Real}(::IntervalRounding{:accurate},
157-
a::T, b::S, $mode1) = $directed(a^b)
156+
@eval ^(::IntervalRounding{:accurate},
157+
a::T, b::S, $mode1) where {T<:AbstractFloat,S<:Real} = $directed(a^b)
158158

159-
@eval ^{T<:AbstractFloat,S<:Real}(::IntervalRounding{:none},
160-
a::T, b::S, $mode1) = a^b
159+
@eval ^(::IntervalRounding{:none},
160+
a::T, b::S, $mode1) where {T<:AbstractFloat,S<:Real} = a^b
161161

162162

163163
# functions not in CRlibm:
164164
for f in (:sqrt, :inv, :tanh, :asinh, :acosh, :atanh)
165165

166-
@eval function $f{T<:AbstractFloat}(::IntervalRounding{:slow},
167-
a::T, $mode1)
166+
@eval function $f(::IntervalRounding{:slow},
167+
a::T, $mode1) where T<:AbstractFloat
168168
setrounding(T, $mode2) do
169169
$f(a)
170170
end
171171
end
172172

173173

174-
@eval $f{T<:AbstractFloat}(::IntervalRounding{:accurate},
175-
a::T, $mode1) = $directed($f(a))
174+
@eval $f(::IntervalRounding{:accurate},
175+
a::T, $mode1) where {T<:AbstractFloat} = $directed($f(a))
176176

177-
@eval $f{T<:AbstractFloat}(::IntervalRounding{:none},
178-
a::T, $mode1) = $f(a)
177+
@eval $f(::IntervalRounding{:none},
178+
a::T, $mode1) where {T<:AbstractFloat} = $f(a)
179179

180180

181181
end
@@ -184,14 +184,14 @@ for mode in (:Down, :Up)
184184
# Functions defined in CRlibm
185185

186186
for f in CRlibm.functions
187-
@eval $f{T<:AbstractFloat}(::IntervalRounding{:slow},
188-
a::T, $mode1) = CRlibm.$f(a, $mode2)
187+
@eval $f(::IntervalRounding{:slow},
188+
a::T, $mode1) where {T<:AbstractFloat} = CRlibm.$f(a, $mode2)
189189

190-
@eval $f{T<:AbstractFloat}(::IntervalRounding{:accurate},
191-
a::T, $mode1) = $directed($f(a))
190+
@eval $f(::IntervalRounding{:accurate},
191+
a::T, $mode1) where {T<:AbstractFloat} = $directed($f(a))
192192

193-
@eval $f{T<:AbstractFloat}(::IntervalRounding{:none},
194-
a::T, $mode1) = $f(a)
193+
@eval $f(::IntervalRounding{:none},
194+
a::T, $mode1) where {T<:AbstractFloat} = $f(a)
195195

196196
end
197197
end
@@ -214,7 +214,7 @@ function _setrounding(::Type{Interval}, rounding_type::Symbol)
214214

215215
# binary functions:
216216
for f in (:+, :-, :*, :/)
217-
@eval $f{T<:AbstractFloat}(a::T, b::T, r::RoundingMode) = $f($roundtype, a, b, r)
217+
@eval $f(a::T, b::T, r::RoundingMode) where {T<:AbstractFloat} = $f($roundtype, a, b, r)
218218
end
219219

220220
if rounding_type == :tight # for remaining functions, use CRlibm
@@ -223,16 +223,16 @@ function _setrounding(::Type{Interval}, rounding_type::Symbol)
223223

224224
for f in (:^, :atan2)
225225

226-
@eval $f{T<:AbstractFloat}(a::T, b::T, r::RoundingMode) = $f($roundtype, a, b, r)
226+
@eval $f(a::T, b::T, r::RoundingMode) where {T<:AbstractFloat} = $f($roundtype, a, b, r)
227227
end
228228

229-
@eval ^{T<:AbstractFloat, S<:Real}(a::T, b::S, r::RoundingMode) = ^($roundtype, promote(a, b)..., r)
229+
@eval ^(a::T, b::S, r::RoundingMode) where {T<:AbstractFloat, S<:Real} = ^($roundtype, promote(a, b)..., r)
230230

231231
# unary functions:
232232
for f in vcat(CRlibm.functions,
233233
[:sqrt, :inv, :tanh, :asinh, :acosh, :atanh])
234234

235-
@eval $f{T<:AbstractFloat}(a::T, r::RoundingMode) = $f($roundtype, a, r)
235+
@eval $f(a::T, r::RoundingMode) where {T<:AbstractFloat} = $f($roundtype, a, r)
236236

237237
@eval $f(x::Real, r::RoundingMode) = $f(float(x), r)
238238

src/intervals/set_operations.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Checks if the number `x` is a member of the interval `a`, treated as a set.
99
Corresponds to `isMember` in the ITF-1788 Standard.
1010
"""
11-
function in{T<:Real}(x::T, a::Interval)
11+
function in(x::T, a::Interval) where T<:Real
1212
isinf(x) && return false
1313
a.lo <= x <= a.hi
1414
end

src/intervals/special.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ function iscommon(a::Interval)
5858
end
5959

6060
doc"`widen(x)` widens the lowest and highest bounds of `x` to the previous and next representable floating-point numbers, respectively."
61-
widen{T<:AbstractFloat}(x::Interval{T}) = Interval(prevfloat(x.lo), nextfloat(x.hi))
61+
widen(x::Interval{T}) where {T<:AbstractFloat} = Interval(prevfloat(x.lo), nextfloat(x.hi))
6262

6363
"""
6464
wideinterval(x::AbstractFloat)
6565
6666
Returns the interval Interval( prevfloat(x), nextfloat(x) ).
6767
"""
68-
wideinterval{T<:AbstractFloat}(x::T) = Interval( prevfloat(x), nextfloat(x) )
68+
wideinterval(x::T) where {T<:AbstractFloat} = Interval( prevfloat(x), nextfloat(x) )
6969

7070
"""
7171
isatomic(x::Interval)

src/intervals/trigonometric.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ half_pi(x::T) where T<:AbstractFloat = half_pi(T)
55

66
two_pi(::Type{T}) where T = pi_interval(T) * 2
77

8-
range_atan2{T<:Real}(::Type{T}) = Interval(-(pi_interval(T).hi), pi_interval(T).hi)
9-
half_range_atan2{T}(::Type{T}) = (temp = half_pi(T); Interval(-(temp.hi), temp.hi) )
10-
pos_range_atan2{T<:Real}(::Type{T}) = Interval(zero(T), pi_interval(T).hi)
8+
range_atan2(::Type{T}) where {T<:Real} = Interval(-(pi_interval(T).hi), pi_interval(T).hi)
9+
half_range_atan2(::Type{T}) where {T} = (temp = half_pi(T); Interval(-(temp.hi), temp.hi) )
10+
pos_range_atan2(::Type{T}) where {T<:Real} = Interval(zero(T), pi_interval(T).hi)
1111

1212

1313
doc"""Finds the quadrant(s) corresponding to a given floating-point

src/multidim/intervalbox.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ import Base.×
5353
×(a::IntervalBox, b::Interval) = IntervalBox(a..., b)
5454
×(a::IntervalBox, b::IntervalBox) = IntervalBox(a..., b...)
5555

56-
IntervalBox{n}(x::Interval, ::Type{Val{n}}) = IntervalBox(SVector(ntuple(i->x, Val{n})))
56+
IntervalBox(x::Interval, ::Type{Val{n}}) where {n} = IntervalBox(SVector(ntuple(i->x, Val{n})))
5757

5858
IntervalBox(x::Interval, n::Int) = IntervalBox(x, Val{n})

src/plot_recipes/plot_recipes.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ using RecipesBase
1515
end
1616

1717
# Plot a vector of 2D IntervalBoxes:
18-
@recipe function f{T<:IntervalBox{2}}(v::Vector{T})
18+
@recipe function f(v::Vector{T}) where T<:IntervalBox{2}
1919

2020
seriestype := :shape
2121

0 commit comments

Comments
 (0)