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 18, 2023
1 parent 9ae3c19 commit 067e6ac
Show file tree
Hide file tree
Showing 2 changed files with 9 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 JULIA_HAS_EXTENSIONS = isdefined(Base, :get_extension) # introduced in v1.9

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

using Aqua: JULIA_HAS_EXTENSIONS

if VERSION >= v"1.6-"
using Test: is_in_mods
else
Expand Down Expand Up @@ -160,6 +162,11 @@ end
function is_pirate(meth::Method; treat_as_own = Union{Function,Type}[])
method_pkg = Base.PkgId(meth.module)

# Package extensions behave as the package itself
@static if JULIA_HAS_EXTENSIONS

Check warning on line 166 in src/piracy.jl

View check run for this annotation

Codecov / codecov/patch

src/piracy.jl#L166

Added line #L166 was not covered by tests
method_pkg = get(Base.EXT_PRIMED, method_pkg, method_pkg)
end

signature = Base.unwrap_unionall(meth.sig)

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

0 comments on commit 067e6ac

Please sign in to comment.