From 7ba59d6508123af9002a6e6b004bbe90e321f970 Mon Sep 17 00:00:00 2001 From: kalmar Date: Mon, 5 Jun 2017 21:36:31 +0200 Subject: [PATCH] safer coercion of GroupRingElem to GroupRing --- src/GroupRings.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index cc2faab..31bbff1 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -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 ############################################################################### #