Skip to content

Commit

Permalink
change deprecation to avoid export (#473)
Browse files Browse the repository at this point in the history
* change deprecation to avoid export

* rework testing

* avoid failure on 1.6
  • Loading branch information
jverzani authored Feb 23, 2023
1 parent 474bcde commit 28d6137
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "Polynomials"
uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
license = "MIT"
author = "JuliaMath"
version = "3.2.4"
version = "3.2.5"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
7 changes: 6 additions & 1 deletion src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,12 @@ has a nonzero coefficient. The degree of the zero polynomial is defined to be -1
"""
degree(p::AbstractPolynomial) = iszero(coeffs(p)) ? -1 : length(coeffs(p)) - 1 + min(0, minimumexponent(p))

@deprecate order degree true
function order(p::AbstractPolynomial)
Base.depwarn("The `order` function is deprecated. Use `degree`.",
:AbstractPolynomial)
degree(p)
end


"""
Polynomials.domain(::Type{<:AbstractPolynomial})
Expand Down
1 change: 0 additions & 1 deletion test/ChebyshevT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
@test p.coeffs == coeff
@test coeffs(p) == coeff
@test degree(p) == length(coeff) - 1
@test (@test_deprecated order(p)) == length(coeff) - 1
@test Polynomials.indeterminate(p) == :x
@test length(p) == length(coeff)
@test size(p) == size(coeff)
Expand Down
8 changes: 8 additions & 0 deletions test/StandardBasis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ Base.getindex(z::ZVector, I::Int) = parent(z)[I + z.offset]
@test Polynomials.isconstant(P(1))
@test !Polynomials.isconstant(variable(P))
end

## issue #457
if VERSION >= v"1.7.0"
p = Polynomial([1,2,3])
@test_warn "deprecated" Polynomials.order(p)
@test Polynomials.order(p) == 2
end

end

@testset "Non-number type" begin
Expand Down

2 comments on commit 28d6137

@jverzani
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/78386

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v3.2.5 -m "<description of version>" 28d61378d1b4ca222a21c1c5677646daff945f1c
git push origin v3.2.5

Please sign in to comment.