From a6e4dabcc60ac971daccde3f8b17026a2d1069af Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 28 Nov 2018 22:56:28 +0100 Subject: [PATCH] Update comment in LibGAP.jl/src/gap_to_julia.jl Co-Authored-By: sebasguts --- LibGAP.jl/src/gap_to_julia.jl | 4 ++-- LibGAP.jl/test/conversion.jl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/LibGAP.jl/src/gap_to_julia.jl b/LibGAP.jl/src/gap_to_julia.jl index cc831b758..e9fead5d9 100644 --- a/LibGAP.jl/src/gap_to_julia.jl +++ b/LibGAP.jl/src/gap_to_julia.jl @@ -126,7 +126,7 @@ function gap_to_julia( ::Type{Array{Obj,1}}, obj :: MPtr , recursion_dict = IdDi new_array = Array{Any,1}( undef, len_list) recursion_dict[obj] = new_array for i in 1:len_list - current_obj = ElmList(obj,i) + current_obj = ElmList(obj,i) # returns 'nothing' for holes in the list if haskey(recursion_dict,current_obj) new_array[ i ] = recursion_dict[current_obj] else @@ -159,7 +159,7 @@ function gap_to_julia( ::Type{Array{T,1}}, obj :: MPtr, recursion_dict = IdDict( return new_array end -## Special case for conversion of lists with holes +## Special case for conversion of lists with holes; these are converted into 'nothing' function gap_to_julia( ::Type{Array{Union{Nothing,T},1}}, obj :: MPtr, recursion_dict = IdDict() ) where T if ! Globals.IsList( obj ) throw(ArgumentError(" is not a list")) diff --git a/LibGAP.jl/test/conversion.jl b/LibGAP.jl/test/conversion.jl index c623e39a6..215d26167 100644 --- a/LibGAP.jl/test/conversion.jl +++ b/LibGAP.jl/test/conversion.jl @@ -112,7 +112,7 @@ xx = GAP.julia_to_gap( "a" ) @test_throws MethodError GAP.gap_to_julia( Dict{Int64,Int64}, xx ) - ## Test nothing + ## Test converting GAP lists with holes in them xx = GAP.EvalString( "[1,,1]" ) @test GAP.gap_to_julia(xx) == Any[1,nothing,1] @test GAP.gap_to_julia(Array{Any,1},xx) == Any[1,nothing,1] @@ -222,7 +222,7 @@ end conv = GAP.julia_to_gap(d, Val(true)); @test conv === conv.b - ## Test nothing + ## Test converting lists with 'nothing' in them -> should be converted to a hole in the list xx = GAP.EvalString( "[1,,1]" ) @test GAP.julia_to_gap([1,nothing,1]) == xx