From db4a0aa0b09f57a36a3079967ff17ed453653dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Mon, 17 Jul 2023 23:00:32 +0200 Subject: [PATCH] Extensions do not commit piracy against base package --- src/Aqua.jl | 2 ++ src/piracy.jl | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/Aqua.jl b/src/Aqua.jl index 2f203016..b3253124 100644 --- a/src/Aqua.jl +++ b/src/Aqua.jl @@ -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 diff --git a/src/piracy.jl b/src/piracy.jl index e29018bf..5d8193cf 100644 --- a/src/piracy.jl +++ b/src/piracy.jl @@ -1,5 +1,7 @@ module Piracy +using Aqua: HAS_EXTENSIONS + if VERSION >= v"1.6-" using Test: is_in_mods else @@ -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)