From d68647de2f28f28fc3d209bee528e207b18db4b2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 1 Nov 2023 23:33:13 +0100 Subject: [PATCH] Fix more JET issues Some found via @report_opt --- src/GAP.jl | 4 ++-- src/adapter.jl | 2 +- src/ccalls.jl | 6 +++--- src/constructors.jl | 4 ++-- src/julia_to_gap.jl | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/GAP.jl b/src/GAP.jl index 7746378e..55a5d3da 100644 --- a/src/GAP.jl +++ b/src/GAP.jl @@ -69,8 +69,8 @@ function error_handler() if disable_error_handler[] return end - last_error[] = String(Globals._JULIAINTERFACE_ERROR_BUFFER) - ccall((:SET_LEN_STRING, libgap), Cvoid, (GapObj, Cuint), Globals._JULIAINTERFACE_ERROR_BUFFER, 0) + last_error[] = String(Globals._JULIAINTERFACE_ERROR_BUFFER::GapObj) + ccall((:SET_LEN_STRING, libgap), Cvoid, (GapObj, Cuint), Globals._JULIAINTERFACE_ERROR_BUFFER::GapObj, 0) end function ThrowObserver(depth::Cint) diff --git a/src/adapter.jl b/src/adapter.jl index 3e16b8dc..3c650bca 100644 --- a/src/adapter.jl +++ b/src/adapter.jl @@ -9,7 +9,7 @@ function show_string(io::IO, obj::Union{GapObj,FFE}) str = Wrappers.StringViewObj(obj) stri = CSTR_STRING(str) lines = split(stri, "\n") - rows = displaysize(io)[1]-3 # the maximum number of lines to show + rows = displaysize(io)[1]::Int - 3 # the maximum number of lines to show if length(lines) > rows # For objects that do not fit on the screen, # show only the first and the last lines. diff --git a/src/ccalls.jl b/src/ccalls.jl index 9e52a0d9..3d71f342 100644 --- a/src/ccalls.jl +++ b/src/ccalls.jl @@ -136,17 +136,17 @@ whereas `x` in the latter example lives in the Julia session. """ function evalstr(cmd::String) res = evalstr_ex(cmd * ";") - if any(x->x[1] == false, res) + if any(x::GapObj->x[1] === false, res) # error global last_error # HACK HACK HACK: if there is an error string on the GAP side, call # error_handler to copy it into `last_error` - if !Wrappers.IsEmpty(Globals._JULIAINTERFACE_ERROR_BUFFER) + if !Wrappers.IsEmpty(Globals._JULIAINTERFACE_ERROR_BUFFER::GapObj) error_handler() end error("Error thrown by GAP: $(last_error[])") end - res = res[end] + res = res[end]::GapObj if Wrappers.ISB_LIST(res, 2) return res[2] else diff --git a/src/constructors.jl b/src/constructors.jl index d5c761e0..4e02af7b 100644 --- a/src/constructors.jl +++ b/src/constructors.jl @@ -209,7 +209,7 @@ julia> String(val) # an empty GAP list is a string """ function String(obj::GapObj) Wrappers.IsStringRep(obj) && return CSTR_STRING(obj) - Wrappers.IsString(obj) && return CSTR_STRING(Wrappers.CopyToStringRep(obj)) + Wrappers.IsString(obj) && return CSTR_STRING(Wrappers.CopyToStringRep(obj)::GapObj) throw(ConversionError(obj, String)) end @@ -257,7 +257,7 @@ function BitVector(obj::GapObj) len = Wrappers.Length(obj)::Int result = BitVector(undef, len) for i = 1:len - result[i] = obj[i] + result[i] = obj[i]::Bool end return result end diff --git a/src/julia_to_gap.jl b/src/julia_to_gap.jl index 1de615d2..64d30108 100644 --- a/src/julia_to_gap.jl +++ b/src/julia_to_gap.jl @@ -219,7 +219,7 @@ function julia_to_gap( elseif Wrappers.IsRecord(obj) ret_val = NewPrecord(0) recursion_dict[obj] = ret_val - for x in Vector{String}(Wrappers.RecNames(obj)) + for x in Vector{String}(Wrappers.RecNames(obj)::GapObj) Wrappers.ASS_REC(ret_val, x, julia_to_gap(Wrappers.ELM_REC(obj, x), recursion_dict; recursive = true)) end else