From 37492ce6144af4a90d956caa9af33fad8675e727 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Wed, 22 Mar 2023 19:31:02 -0500 Subject: [PATCH] Fix/disable tests on 1.9 (#37) --- src/findcallers.jl | 3 +++ test/runtests.jl | 20 ++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/findcallers.jl b/src/findcallers.jl index d2560c1..18d034c 100644 --- a/src/findcallers.jl +++ b/src/findcallers.jl @@ -125,6 +125,9 @@ function findcallers(f, argmatch::Union{Function,Nothing}, mis::AbstractVector{C callee = nothing if stmt.head === callhead callee = stmt.args[1] + if isglobalref(callee, Core, :kwcall) && length(stmt.args) >= 3 + callee = stmt.args[3] + end elseif callhead === :iterate && stmt.head === :call && isglobalref(stmt.args[1], Core, :_apply_iterate) callee = stmt.args[3] end diff --git a/test/runtests.jl b/test/runtests.jl index e00a3d4..d73041b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -45,16 +45,20 @@ end @testset "visit" begin # Do we pick up kwfuncs? - meths = Set{Method}() - visit(Outer) do item - if item isa Method - push!(meths, item) - return false + # This is skipped on Julia versions that use `Core.kwcall`, as the methods are found by traversing Core. + # See issue #36 + if !isdefined(Core, :kwcall) + meths = Set{Method}() + visit(Outer) do item + if item isa Method + push!(meths, item) + return false + end + return true end - return true + mkw = only(methods(Core.kwfunc(Outer.fkw), (Any, typeof(Outer.fkw), Vararg{Any}))) + @test mkw in meths end - mkw = only(methods(Core.kwfunc(Outer.fkw), (Any, typeof(Outer.fkw), Vararg{Any}))) - @test mkw in meths @test Outer.Inner.g("hi") == 0 @test Outer.f(nothing) == 1