Skip to content

Commit eebfbd1

Browse files
committed
Make julia pre-1.6 happy
1 parent f7ecafa commit eebfbd1

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/piracy.jl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
module Piracy
22

3-
import Test
3+
if VERSION >= v"1.6-"
4+
using Test: is_in_mods
5+
else
6+
function is_in_mods(m::Module, recursive::Bool, mods)
7+
while true
8+
m in mods && return true
9+
recursive || return false
10+
p = parentmodule(m)
11+
p === m && return false
12+
m = p
13+
end
14+
end
15+
end
416

517
# based on Test/Test.jl#detect_ambiguities
618
# https://github.com/JuliaLang/julia/blob/v1.9.1/stdlib/Test/src/Test.jl#L1838-L1896
@@ -13,7 +25,7 @@ function all_methods(mods::Module...; skip_deprecated::Bool)
1325
end
1426
function examine(ml::Base.MethodList)
1527
for m in ml
16-
Test.is_in_mods(m.module, true, mods) || continue
28+
is_in_mods(m.module, true, mods) || continue
1729
push!(meths, m)
1830
end
1931
end

0 commit comments

Comments
 (0)