diff --git a/src/Rings/mpoly-graded.jl b/src/Rings/mpoly-graded.jl index 1897038d8f61..f98d30187a6f 100644 --- a/src/Rings/mpoly-graded.jl +++ b/src/Rings/mpoly-graded.jl @@ -8,6 +8,7 @@ multi_hilbert_series_parent::Generic.LaurentMPolyWrapRing{ZZRingElem, ZZMPolyRing} function MPolyDecRing(R::S, d::Vector{FinGenAbGroupElem}) where {S} + @req !(R isa MPolyDecRing) "cannot grade polynomial ring which is already decorated" @assert length(d) == ngens(R) r = new{elem_type(base_ring(R)), S}() r.R = R @@ -16,6 +17,7 @@ return r end function MPolyDecRing(R::S, d::Vector{FinGenAbGroupElem}, lt) where {S} + @req !(R isa MPolyDecRing) "cannot filter polynomial ring which is already decorated" @assert length(d) == ngens(R) r = new{elem_type(base_ring(R)), S}() r.R = R @@ -135,7 +137,7 @@ of `R`, and return the new ring, together with the vector of variables. As above, where the grading is the standard $\mathbb Z$-grading on `R`. # Examples -```jldoctest +```jldoctest grade-ex julia> R, (x, y, z) = polynomial_ring(QQ, [:x, :y, :z]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) @@ -156,8 +158,15 @@ Multivariate polynomial ring in 3 variables over QQ graded by x -> [1] y -> [1] z -> [1] +``` +Grading an already graded polynomial ring is not supported. +```jldoctest grade-ex +julia> grade(S) +ERROR: ArgumentError: cannot grade polynomial ring which is already decorated ``` +To produce a new ring with different grading, you need to first +call `forget_grading` and then `grade` the result. """ function grade(R::MPolyRing, W::AbstractVector{<:IntegerUnion}) @assert length(W) == ngens(R) diff --git a/test/Serialization/PolynomialsSeries.jl b/test/Serialization/PolynomialsSeries.jl index b3c14e8ed770..980e477708cf 100644 --- a/test/Serialization/PolynomialsSeries.jl +++ b/test/Serialization/PolynomialsSeries.jl @@ -54,12 +54,6 @@ cases = [ @test loaded == m1 * m2 @test grading_group(parent(loaded)) == grading_group(M) end - - GM, _ = grade(M, A) - test_save_load_roundtrip(path, GM) do loaded - @test loaded == GM - @test forget_grading(loaded) == forget_grading(GM) - end end for case in cases diff --git a/test/Serialization/upgrades/setup_tests.jl b/test/Serialization/upgrades/setup_tests.jl index 6afd7377df7a..8e8e7c4afadd 100644 --- a/test/Serialization/upgrades/setup_tests.jl +++ b/test/Serialization/upgrades/setup_tests.jl @@ -6,7 +6,7 @@ if !isdefined(Main, :serialization_upgrade_test_path) || !isdir(Main.serialization_upgrade_test_path) || !isfile(joinpath(Main.serialization_upgrade_test_path, "LICENSE.md")) - serialization_upgrade_test_path = let commit_hash = "a28d9e4dcc89de46377061e2f42ee09739735b97" + serialization_upgrade_test_path = let commit_hash = "0b7ff9e5e1135ddeaf83bd20313946183522e0ae" tarball = Downloads.download("https://github.com/oscar-system/serialization-upgrade-tests/archive/$(commit_hash).tar.gz") destpath = open(CodecZlib.GzipDecompressorStream, tarball) do io