Skip to content

Commit

Permalink
Extensions do not commit piracy against base package
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Jul 17, 2023
1 parent 8dbb2f5 commit 67e2869
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Aqua.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ using Base: PkgId, UUID
using Pkg: Pkg, TOML
using Test

const HAS_EXTENSIONS = isdefined(Base, :get_extension) # introduced in v1.9

try
findnext('a', "a", 1)
catch
Expand Down
5 changes: 5 additions & 0 deletions src/piracy.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Piracy

using Aqua: HAS_EXTENSIONS

if VERSION >= v"1.6-"
using Test: is_in_mods
else
Expand Down Expand Up @@ -159,6 +161,9 @@ end

function is_pirate(meth::Method; treat_as_own = Union{Function,Type}[])
method_pkg = Base.PkgId(meth.module)
@static if HAS_EXTENSIONS
method_pkg = get(Base.EXT_PRIMED, method_pkg, method_pkg)
end

signature = Base.unwrap_unionall(meth.sig)

Expand Down

0 comments on commit 67e2869

Please sign in to comment.