Skip to content

Commit

Permalink
fix: check argument for map of polynomial rings (#4398)
Browse files Browse the repository at this point in the history
  • Loading branch information
thofma authored Dec 12, 2024
1 parent 6b027f0 commit 9a4a751
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Rings/MPolyMap/MPolyQuo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ end
# The two main evaluation methods
function (F::MPolyAnyMap{<: MPolyQuoRing})(g)
if g isa elem_type(domain(F))
@req parent(g) === domain(F) "Element not in domain"
if coefficient_map(F) === nothing
return _evaluate_plain(F, g)
else
Expand Down
10 changes: 10 additions & 0 deletions test/Rings/MPolyAnyMap/MPolyQuo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,14 @@ end
# The test is whether the following two lines work at all
AtoR = @inferred hom(A, R, QtoR, [ x^2, y^2, x*y ])
@test isone(AtoR(A(1)))

let
Qt, (t,) = polynomial_ring(QQ, [:t])
QT, (T,) = polynomial_ring(QQ, [:T])
Q1, = quo(Qt, ideal(Qt, [t]))
Q2, = quo(QT, ideal(QT, [T^2]))
h = hom(Q2, Q1, [Qt(t)])
@test_throws ArgumentError h(t)
end

end

0 comments on commit 9a4a751

Please sign in to comment.