Julia nightly demands that convert(T, x) produce a result of type T. This is currently not the case with RationalPolynomials, where promote_rule at various places hard-codes Polynomial instead of using a proper promotion. As a consequence, the following is broken (and tests fail on Julia nightly in general):
julia> r = SparsePolynomial([1,2], :x)
(SparsePolynomial(1 + 2*x)
julia> rr = r // (r-1)
(1 + 2*x) // (2*x)
julia> oftype(rr, r)
ERROR: TypeError: in typeassert, expected RationalFunction{Int64, :x, SparsePolynomial{Int64, :x}}, got a value of type RationalFunction{Int64, :x, Polynomial{Int64, :x}}
Stacktrace:
[1] oftype(x::RationalFunction{Int64, :x, SparsePolynomial{Int64, :x}}, y::SparsePolynomial{Int64, :x})
@ Base ./essentials.jl:641
[2] top-level scope
@ REPL[12]:1
Julia nightly demands that
convert(T, x)produce a result of typeT. This is currently not the case withRationalPolynomials, wherepromote_ruleat various places hard-codesPolynomialinstead of using a proper promotion. As a consequence, the following is broken (and tests fail on Julia nightly in general):