Skip to content

Commit

Permalink
Re-enable REPL completion for GAP records in Julia 1.10
Browse files Browse the repository at this point in the history
The added annotation might also benefit performance of some code
  • Loading branch information
fingolfin committed Jul 28, 2023
1 parent 3623cee commit aab3f91
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "0.9.8-DEV"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
GAP_jll = "5cd7a574-2c56-5be2-91dc-c8bc375b9ddf"
GAP_lib_jll = "de1ad85e-c930-5cd4-919d-ccd3fcafd1a3"
Expand All @@ -21,6 +22,7 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Scratch = "6c6a2e73-6563-6170-7368-637461726353"

[compat]
Compat = "4.4.0"
GAP_jll = "~400.1200.101"
GAP_lib_jll = "~400.1201.100"
GAP_pkg_juliainterface_jll = "=0.800.300"
Expand Down
5 changes: 3 additions & 2 deletions src/ccalls.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
## Internal ccall's
import Compat # for Base.@assume_effects emulation in Julia <= 1.7

import Base: getproperty, hasproperty, setproperty!, propertynames

#
# low-level GAP -> Julia conversion
#
function _GAP_TO_JULIA(ptr::Ptr{Cvoid})
Compat.@assume_effects :effect_free :terminates_globally 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 @@ -155,7 +156,7 @@ 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.
function _ValueGlobalVariable(name::Union{AbstractString,Symbol})
Compat.@assume_effects :effect_free :terminates_globally function _ValueGlobalVariable(name::Union{AbstractString,Symbol})
return ccall((:GAP_ValueGlobalVariable, libgap), Ptr{Cvoid}, (Cstring,), name)
end

Expand Down
4 changes: 0 additions & 4 deletions src/globals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ propertynames(::GlobalsType, private::Bool=false) = Vector{Symbol}(Globals.Names
return (_GAP_TO_JULIA(v), true)
end
get_value(sym::QuoteNode, fn::GAP.GlobalsType) = get_value(sym.value, fn)

else
# TODO: the above HACK does not work anymore in Julia 1.10; someone needs
# to find out how to make it work there
end

propertynames(r::GapObj, private::Bool=false) = Wrappers.IsRecord(r) ? Vector{Symbol}(Wrappers.RecNames(r)) : Vector{Symbol}()
7 changes: 1 addition & 6 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ include("constructors.jl")
include("macros.jl")
include("packages.jl")
include("help.jl")

@static if VERSION < v"1.10-DEV"
# TODO: re-enable this test in Julia 1.10 once we get REPL completion
# working there
include("replcompletions.jl")
end
include("replcompletions.jl")

@testset "manual examples" begin
include("doctest.jl")
Expand Down

0 comments on commit aab3f91

Please sign in to comment.