MultivariatePolynomials.jl icon indicating copy to clipboard operation
MultivariatePolynomials.jl copied to clipboard

Fixed promote rule bug

Open kaandocal opened this issue 4 years ago • 5 comments

Related to this issue. The generic promote_rule in question is provided symmetrically (as far as I'm aware promote_type takes care of that), but the specialisation to T=Any is only provided in one direction. This fixes the problem I was having.

kaandocal avatar Sep 02 '21 13:09 kaandocal

Thanks, could you add a test ?

blegat avatar Oct 12 '21 20:10 blegat

I'm not sure what test to add for this - the Julia docs state that promote_rule does not need to be specified symmetrically, this commit just removed one redundant definition :)

kaandocal avatar Oct 13 '21 00:10 kaandocal

Adding

promote_type(Any, typeof(MP.changecoefficienttype(x + 1, Any)))

in https://github.com/JuliaAlgebra/MultivariatePolynomials.jl/blob/master/test/promote.jl should cover it.

blegat avatar Oct 13 '21 22:10 blegat

I managed to avoid the issue with some restructuring, but in the interest of closing this I added the proposed test

kaandocal avatar Apr 09 '22 10:04 kaandocal

I ran into a similar stack overflow error doing this:

using DynamicPolynomials
@polyvar x
@ncpolyvar y
x + y

Might be the same underlying problem.

kbarros avatar Oct 01 '22 17:10 kbarros