Skip to content

Commit 8b1c45a

Browse files
authored
fix invalidations; close issue #403 (#406)
* fix invalidations; close issue #403 * better fix, but not as general
1 parent ddb9e57 commit 8b1c45a

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
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.1.0"
5+
version = "3.1.1"
66

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

src/common.jl

+3-7
Original file line numberDiff line numberDiff line change
@@ -426,13 +426,9 @@ LinearAlgebra.transpose!(p::AbstractPolynomial) = p
426426
Conversions =#
427427
Base.convert(::Type{P}, p::P) where {P <: AbstractPolynomial} = p
428428
Base.convert(P::Type{<:AbstractPolynomial}, x) = P(x)
429-
function Base.convert(::Type{S}, p::P) where {S <: Number,T, P<:AbstractPolynomial{T}}
430-
isconstant(p) && return convert(S, constantterm(p))
431-
throw(ArgumentError("Can't convert a nonconstant polynomial to type $S"))
432-
end
433-
function Base.convert(::Type{T}, p::P) where {T, P<:AbstractPolynomial{T}}
434-
isconstant(p) && return constantterm(p)
435-
throw(ArgumentError("Can't convert a nonconstant polynomial to type $S"))
429+
function Base.convert(::Type{T}, p::AbstractPolynomial{T,X}) where {T <: Number,X}
430+
isconstant(p) && return T(constantterm(p))
431+
throw(ArgumentError("Can't convert a nonconstant polynomial to type $T"))
436432
end
437433

438434
# Methods to ensure that matrices of polynomials behave as desired

0 commit comments

Comments
 (0)