Skip to content

Commit

Permalink
Fix TAB completion for e.g. 'GAP.Globals.MTX.S' in Julia >= 1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Feb 22, 2024
1 parent fb0520e commit b7b3c23
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ccalls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import Base: getproperty, hasproperty, setproperty!, propertynames
#
# low-level GAP -> Julia conversion
#
Compat.@assume_effects :effect_free :terminates_globally function _GAP_TO_JULIA(ptr::Ptr{Cvoid})
# The 'assume_effects' is needed for tab completion of "nested" constructs,
# e.g. when entering `GAP.Globals.MTX.S` on the REPL then pressing TAB.
Compat.@assume_effects :foldable !:consistent function _GAP_TO_JULIA(ptr::Ptr{Cvoid})
ptr == C_NULL && return nothing
# convert immediate ints and FFEs directly, to avoid (un)boxing
as_int = reinterpret(Int, ptr)
Expand Down Expand Up @@ -157,7 +159,10 @@ end

# Retrieve the value of a global GAP variable given its name. This function
# returns a raw Ptr value, and should only be called by plumbing code.
Compat.@assume_effects :effect_free :terminates_globally function _ValueGlobalVariable(name::Union{AbstractString,Symbol})
#
# The 'assume_effects' is needed for tab completion of "nested" constructs,
# e.g. when entering `GAP.Globals.MTX.S` on the REPL then pressing TAB.
Compat.@assume_effects :foldable !:consistent function _ValueGlobalVariable(name::Union{AbstractString,Symbol})
return ccall((:GAP_ValueGlobalVariable, libgap), Ptr{Cvoid}, (Cstring,), name)
end

Expand Down

0 comments on commit b7b3c23

Please sign in to comment.