diff --git a/src/generic/UnivPoly.jl b/src/generic/UnivPoly.jl index 40f995f4fe..54d264436a 100644 --- a/src/generic/UnivPoly.jl +++ b/src/generic/UnivPoly.jl @@ -516,9 +516,15 @@ for op in (:+, :-, :*) return UnivPoly{T}($op(data(p),n), S) end - $op(n::Union{Integer, Rational, AbstractFloat}, p::UnivPoly) = $op(p,n) + function $op(n::Union{Integer, Rational, AbstractFloat}, p::UnivPoly{T}) where {T} + S = parent(p) + return UnivPoly{T}($op(n,data(p)), S) + end - $op(n::T, p::UnivPoly{T}) where {T <: RingElem} = $op(p,n) + function $op(n::T, p::UnivPoly{T}) where {T <: RingElem} + S = parent(p) + return UnivPoly{T}($op(n,data(p)), S) + end end end