diff --git a/src/deprecations.jl b/src/deprecations.jl index 101790f9..2c21ea78 100644 --- a/src/deprecations.jl +++ b/src/deprecations.jl @@ -1,4 +1,8 @@ # Removed with 0.16, indexing via non-integers +getindex(itp::AbstractInterpolation{T,N}, i::Vararg{Number,N}) where {T,N} = + error("Indexing an AbstractInterpolation by non-integers is no longer supported in Interpolations.jl since v0.16. Use the function calling interface instead: `itp(i...)`.") +getindex(itp::AbstractInterpolation{T,N}, i::Vararg{ExpandedIndexTypes,N}) where {T,N} = + error("Indexing an AbstractInterpolation by non-integers is no longer supported in Interpolations.jl since v0.16. Use the function calling interface instead: `itp(i...)`.") for T in (:Throw, :Flat, :Line, :Free, :Periodic, :Reflect, :InPlace, :InPlaceQ) @eval begin diff --git a/test/issues/runtests.jl b/test/issues/runtests.jl index 7c1ca52e..cb549a47 100644 --- a/test/issues/runtests.jl +++ b/test/issues/runtests.jl @@ -177,4 +177,10 @@ using Interpolations, Test, ForwardDiff t = -3.0:0.01:3.0 @test itp_cdf.(t) isa Vector{Float64} end + @testset "issue 630" begin + itp = interpolate(ones(100,100), BSpline(Linear())); + # Indexing by non-integers should not result in a StackOverflow due to `Base.to_index(::AbstractInterpolation, x::Number) = x` + @test_throws "Indexing an AbstractInterpolation by non-integers is no longer supported" itp[2.2, 33.3] + @test_throws "Indexing an AbstractInterpolation by non-integers is no longer supported" itp[2.2, 2.0:5.0] + end end