safer coercion of GroupRingElem to GroupRing

This commit is contained in:
kalmar 2017-06-05 21:36:31 +02:00
parent 0972cd1fdc
commit 7ba59d6508
1 changed files with 4 additions and 1 deletions

View File

@ -131,7 +131,10 @@ function (RG::GroupRing)(x::AbstractVector)
return result
end
(RG::GroupRing)(X::GroupRingElem) = RG(X.coeffs)
function (RG::GroupRing)(X::GroupRingElem)
RG == parent(X) || throw("Can not coerce!")
return RG(X.coeffs)
end
###############################################################################
#