Skip to content

Commit 28d6137

Browse files
authored
change deprecation to avoid export (#473)
* change deprecation to avoid export * rework testing * avoid failure on 1.6
1 parent 474bcde commit 28d6137

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name = "Polynomials"
22
uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
33
license = "MIT"
44
author = "JuliaMath"
5-
version = "3.2.4"
5+
version = "3.2.5"
66

77
[deps]
88
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/common.jl

+6-1
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,12 @@ has a nonzero coefficient. The degree of the zero polynomial is defined to be -1
638638
"""
639639
degree(p::AbstractPolynomial) = iszero(coeffs(p)) ? -1 : length(coeffs(p)) - 1 + min(0, minimumexponent(p))
640640

641-
@deprecate order degree true
641+
function order(p::AbstractPolynomial)
642+
Base.depwarn("The `order` function is deprecated. Use `degree`.",
643+
:AbstractPolynomial)
644+
degree(p)
645+
end
646+
642647

643648
"""
644649
Polynomials.domain(::Type{<:AbstractPolynomial})

test/ChebyshevT.jl

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
@test p.coeffs == coeff
1111
@test coeffs(p) == coeff
1212
@test degree(p) == length(coeff) - 1
13-
@test (@test_deprecated order(p)) == length(coeff) - 1
1413
@test Polynomials.indeterminate(p) == :x
1514
@test length(p) == length(coeff)
1615
@test size(p) == size(coeff)

test/StandardBasis.jl

+8
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ Base.getindex(z::ZVector, I::Int) = parent(z)[I + z.offset]
147147
@test Polynomials.isconstant(P(1))
148148
@test !Polynomials.isconstant(variable(P))
149149
end
150+
151+
## issue #457
152+
if VERSION >= v"1.7.0"
153+
p = Polynomial([1,2,3])
154+
@test_warn "deprecated" Polynomials.order(p)
155+
@test Polynomials.order(p) == 2
156+
end
157+
150158
end
151159

152160
@testset "Non-number type" begin

0 commit comments

Comments
 (0)