Skip to content

Commit 6567f63

Browse files
committed
better fix, but not as general
1 parent e4196b1 commit 6567f63

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/common.jl

Lines changed: 3 additions & 7 deletions
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::AbstractPolynomial{T,X}) where {T,X}
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)