diff --git a/src/Rings/MPolyMap/MPolyQuo.jl b/src/Rings/MPolyMap/MPolyQuo.jl index 0c1ebfc0ca54..9c4650858e86 100644 --- a/src/Rings/MPolyMap/MPolyQuo.jl +++ b/src/Rings/MPolyMap/MPolyQuo.jl @@ -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 diff --git a/test/Rings/MPolyAnyMap/MPolyQuo.jl b/test/Rings/MPolyAnyMap/MPolyQuo.jl index 6a7e3929552c..d8275e9afcb3 100644 --- a/test/Rings/MPolyAnyMap/MPolyQuo.jl +++ b/test/Rings/MPolyAnyMap/MPolyQuo.jl @@ -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