/
githubmirror
/
julia
Обзор
Документация
Войти
/
githubmirror
/
julia
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/interpreter.jl
54 строки
2 KB
Andy Dienes
builtins: fix off-by-one nargs in jl_f_invoke CodeInstance fallback (#61110)
21 фев 2026, 21:50
Не верифицирован
21 фев 2026, 21:50
aaf469b
Код
Авторство
О чём код?
# This file is a part of Julia. License is MIT: https://julialang.org/license using Test # interpreted but inferred/optimized top-level expressions with vars let code = """ while true try this_is_undefined_29213 ed = 0 break finally break end end print(42) """ @test read(`$(Base.julia_cmd()) --startup-file=no --compile=min -e $code`, String) == "42" end let code = "Threads.atomic_add!(Threads.Atomic{Int}(40), 2)" @test read(`$(Base.julia_cmd()) --startup-file=no --compile=min -E $code`, String) == "40\n" end let p = Pipe(), c = pipeline(`$(Base.julia_cmd()) --startup-file=no --compile=min -E 'error()'`, stderr=p) proc = run(c, wait=false) readline(p) @test readline(p) == "Stacktrace:" wait(proc) close(p) end # Test generated function behavior in interpreter @test success(pipeline(`$(Base.julia_cmd()) --compile=min -E 'include("staged.jl")'`; stderr)) # Test contextual execution mechanism in interpreter (#54360) let compiler_contextual_test = escape_string(joinpath(@__DIR__,"../Compiler/test/contextual.jl")) @test success(pipeline(`$(Base.julia_cmd()) --compile=min -E "include(\"$compiler_contextual_test\")"`; stderr)) end let code = """ f(args...) = args f(1) mi = first(Base.method_instances(f, Tuple{Int}, Base.get_world_counter())) ci = ccall(:jl_new_codeinst, Ref{Core.CodeInstance}, (Any, Any, Any, Any, Any, Any, Int32, UInt, UInt, UInt32, Any, Any, Any), mi, nothing, Any, Any, nothing, nothing, Int32(0), UInt(1), typemax(UInt), UInt32(0), nothing, nothing, Core.svec()) @assert invoke(f, ci, 42) === (42,) print("ok") """ @test read(`$(Base.julia_cmd()) --startup-file=no --compile=min -e $code`, String) == "ok" end