diff --git a/src/interpret.jl b/src/interpret.jl index 462add1e3f003..6fb460e719bda 100644 --- a/src/interpret.jl +++ b/src/interpret.jl @@ -196,7 +196,12 @@ function bypass_builtins(@nospecialize(recurse), frame, call_expr, pc) f = to_function(fargs[1]) fmod = parentmodule(f)::Module if fmod === JuliaInterpreter.CompiledCalls || fmod === Core.Compiler - return Some{Any}(Base.invokelatest(f, fargs[2:end]...)) + # Fixing https://github.com/JuliaDebug/JuliaInterpreter.jl/issues/432. + @static if VERSION >= v"1.7.0" + return Some{Any}(Base.invoke_in_world(get_world_counter(), f, fargs[2:end]...)) + else + return Some{Any}(Base.invokelatest(f, fargs[2:end]...)) + end else return Some{Any}(f(fargs[2:end]...)) end diff --git a/test/interpret.jl b/test/interpret.jl index f7b80ac08c181..2b0b5be965900 100644 --- a/test/interpret.jl +++ b/test/interpret.jl @@ -823,6 +823,16 @@ module ForInclude end @test JuliaInterpreter.finish_and_return!(Frame(ForInclude, ex), true) == 55 end +@static if VERSION >= v"1.7.0" + @testset "issue #432" begin + function f() + t = @ccall time()::Cint + end + @test @interpret(f()) !== 0 + @test @interpret(f()) !== 0 + end +end + @testset "issue #385" begin using FunctionWrappers:FunctionWrapper @interpret FunctionWrapper{Int,Tuple{}}(()->42)