Skip to content

Commit 067e6ac

Browse files
committed
Extensions do not commit piracy against base package
1 parent 9ae3c19 commit 067e6ac

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/Aqua.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ using Base: PkgId, UUID
44
using Pkg: Pkg, TOML
55
using Test
66

7+
const JULIA_HAS_EXTENSIONS = isdefined(Base, :get_extension) # introduced in v1.9
8+
79
try
810
findnext('a', "a", 1)
911
catch

src/piracy.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module Piracy
22

3+
using Aqua: JULIA_HAS_EXTENSIONS
4+
35
if VERSION >= v"1.6-"
46
using Test: is_in_mods
57
else
@@ -160,6 +162,11 @@ end
160162
function is_pirate(meth::Method; treat_as_own = Union{Function,Type}[])
161163
method_pkg = Base.PkgId(meth.module)
162164

165+
# Package extensions behave as the package itself
166+
@static if JULIA_HAS_EXTENSIONS
167+
method_pkg = get(Base.EXT_PRIMED, method_pkg, method_pkg)
168+
end
169+
163170
signature = Base.unwrap_unionall(meth.sig)
164171

165172
# the first parameter in the signature is the function type, and it

0 commit comments

Comments
 (0)