Skip to content

Commit 5511d40

Browse files
authored
Merge pull request #150 from Evizero/typestable
Make the Extrapolation constructor type-stable
2 parents 734f4aa + 1c49e5f commit 5511d40

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/extrapolation/extrapolation.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
type Extrapolation{T,N,ITPT,IT,GT,ET} <: AbstractExtrapolation{T,N,ITPT,IT,GT}
22
itp::ITPT
33
end
4-
Extrapolation{T,ITPT,IT,GT,ET}(::Type{T}, N, itp::ITPT, ::Type{IT}, ::Type{GT}, et::ET) =
5-
Extrapolation{T,N,ITPT,IT,GT,ET}(itp)
4+
5+
@deprecate Extrapolation{T,ITPT,IT,GT,ET}(::Type{T}, N, itp::ITPT, ::Type{IT}, ::Type{GT}, et::ET) Extrapolation{T,N,ITPT,IT,GT,ET}(itp)
66

77
Base.parent(A::Extrapolation) = A.itp
88

@@ -27,8 +27,8 @@ You can also combine schemes in tuples. For example, the scheme `(Linear(), Flat
2727
2828
Finally, you can specify different extrapolation behavior in different direction. `((Linear(),Flat()), Flat())` will extrapolate linearly in the first dimension if the index is too small, but use constant etrapolation if it is too large, and always use constant extrapolation in the second dimension.
2929
"""
30-
extrapolate{T,N,IT,GT,ET<:ExtrapDimSpec}(itp::AbstractInterpolation{T,N,IT,GT}, et::ET) =
31-
Extrapolation(T,N,itp,IT,GT,et)
30+
extrapolate{T,N,IT,GT,ET<:ExtrapDimSpec}(itp::AbstractInterpolation{T,N,IT,GT}, ::ET) =
31+
Extrapolation{T,N,typeof(itp),IT,GT,ET}(itp)
3232

3333
include("throw.jl")
3434
include("flat.jl")

test/extrapolation/type-stability.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ schemes = (
1515
Periodic
1616
)
1717

18-
for etp in map(E -> extrapolate(itpg, E()), schemes),
18+
for etp in map(E -> @inferred(extrapolate(itpg, E())), schemes),
1919
x in [
2020
# In-bounds evaluation
2121
3.4, 3, dual(3.1),

0 commit comments

Comments
 (0)