Skip to content

Commit

Permalink
Update comment in LibGAP.jl/src/gap_to_julia.jl
Browse files Browse the repository at this point in the history
Co-Authored-By: sebasguts <[email protected]>
  • Loading branch information
fingolfin and sebasguts committed Nov 29, 2018
1 parent 55baa50 commit a6e4dab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions LibGAP.jl/src/gap_to_julia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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("<obj> is not a list"))
Expand Down
4 changes: 2 additions & 2 deletions LibGAP.jl/test/conversion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit a6e4dab

Please sign in to comment.