diff --git a/src/GrpAb/Elem.jl b/src/GrpAb/Elem.jl index 06103a753e..e93914db7b 100644 --- a/src/GrpAb/Elem.jl +++ b/src/GrpAb/Elem.jl @@ -138,6 +138,10 @@ function Base.lastindex(x::FinGenAbGroupElem) return ngens(parent(x)) end +function getindex(x::FinGenAbGroupElem, ::Colon) + return x[begin:end] +end + ################################################################################ # # Comparison diff --git a/test/GrpAb/Elem.jl b/test/GrpAb/Elem.jl index 04dd9bf9ec..fb9340405b 100644 --- a/test/GrpAb/Elem.jl +++ b/test/GrpAb/Elem.jl @@ -7,6 +7,7 @@ @test parent(a) == G @test a.coeff == N @test a[begin:end] == [0, 0, 0] + @test a[:] == [0, 0, 0] G = @inferred abelian_group([3, 0]) N = ZZ[1 1] @@ -14,6 +15,7 @@ @test @inferred parent(a) == G @test a.coeff == N @test a[begin:end] == [1, 1] + @test a[:] == [1, 1] N = matrix(ZZ, 1, 2, [ 1, 1 ]) a = @inferred G(N) @@ -24,6 +26,7 @@ @test @inferred parent(a) == G @test a.coeff == transpose(N) @test a[begin:end] == [1, 1] + @test a[:] == [1, 1] end @testset "Generators" begin