From 8d1c919ad3c2df89cfb4cbcc48532fba62950cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Thu, 28 Sep 2023 16:26:24 +0200 Subject: [PATCH] `Exlcude` now exludes kwsorter as well --- src/ambiguities.jl | 15 +++++---------- test/test_ambiguities.jl | 8 +++----- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/ambiguities.jl b/src/ambiguities.jl index 4c22060e..f2bba52b 100644 --- a/src/ambiguities.jl +++ b/src/ambiguities.jl @@ -176,16 +176,11 @@ end struct _NoValue end function getobj(m::Method) - ty = try - fieldtype(m.sig, 1) - catch err - @error( - "Failed to obtain a function from `Method`.", - exception = (err, catch_backtrace()) - ) - # If this doesn't work, `Base` internal was probably changed - # too much compared to what it is now. So, bailing out. - return _NoValue() + signature = Base.unwrap_unionall(m.sig) + ty = if is_kwcall(signature) + signature.parameters[3] + else + signature.parameters[1] end ty = Base.unwrap_unionall(ty) if ty <: Function diff --git a/test/test_ambiguities.jl b/test/test_ambiguities.jl index 5b7845d4..05f2fb33 100644 --- a/test/test_ambiguities.jl +++ b/test/test_ambiguities.jl @@ -44,7 +44,7 @@ include("preamble.jl") check_testcase([PkgWithAmbiguities.f], total - num_ambs_f) # exclude function and kwsorter - check_testcase([PkgWithAmbiguities.g], total - num_ambs_g; broken = true) + check_testcase([PkgWithAmbiguities.g], total - num_ambs_g) # exclude callables and constructors check_testcase([PkgWithAmbiguities.SingletonType], total - num_ambs_SingletonType) @@ -73,8 +73,7 @@ include("preamble.jl") PkgWithAmbiguities.ConcreteType, PkgWithAmbiguities.ConcreteParameterizedType, ], - 0; - broken = true, + 0, ) else # exclude everything @@ -85,8 +84,7 @@ include("preamble.jl") PkgWithAmbiguities.SingletonType, PkgWithAmbiguities.ConcreteType, ], - 0; - broken = true, + 0, ) end