diff --git a/Project.toml b/Project.toml index 02c7d93..bab71f2 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "DynamicPolynomials" uuid = "7c1d4256-1411-5781-91ec-d7bc3513ac07" repo = "https://github.com/JuliaAlgebra/DynamicPolynomials.jl.git" -version = "0.6.1" +version = "0.6.2" [deps] Future = "9fa8497b-333b-5362-9e8d-4d0656e87820" diff --git a/src/promote.jl b/src/promote.jl index 05eb398..0e697a7 100644 --- a/src/promote.jl +++ b/src/promote.jl @@ -1,3 +1,27 @@ +function MP.promote_rule_constant( + ::Type{Any}, + ::Type{<:DMonomialLike{V,M}}, +) where {V,M} + return Any +end +function MP.promote_rule_constant( + ::Type{Any}, + ::Type{_Term{V,M,T}}, +) where {V,M,T} + return Any +end +function MP.promote_rule_constant( + ::Type{Any}, + ::Type{_Term{V,M,T}}, +) where {V,M,T} + return Any +end +function MP.promote_rule_constant( + ::Type{Any}, + ::Type{<:TermPoly{V,M,T}}, +) where {V,M,T} + return Any +end function MP.promote_rule_constant( ::Type{T}, ::Type{<:DMonomialLike{V,M}}, diff --git a/test/runtests.jl b/test/runtests.jl index ac0c6e0..e96867d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -82,4 +82,11 @@ import DynamicPolynomials end end +@testset "Issue #166: promote_operation with Any" begin + DynamicPolynomials.@polyvar x + V = typeof(x) + @test promote_type(V, Any) == Any + @test promote_type(typeof(x/2), Any) == Any +end + include("mvp.jl")