From 83cda6f944266abdf91ad1eac2c54e8298df3b84 Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Fri, 16 Jun 2023 16:36:07 +0200 Subject: [PATCH] Aqua still errors for some reason --- src/connectivity.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/connectivity.jl b/src/connectivity.jl index de1d649c0..45526d25d 100644 --- a/src/connectivity.jl +++ b/src/connectivity.jl @@ -240,11 +240,12 @@ end # In recursive form, Tarjans algorithm has a recursive call inside a for loop. # To save the loop state of each recursive step in a stack efficiently, # we need to infer the type of its state (which should almost always be an int). -infer_nb_iterstate_type(g::AbstractSimpleGraph) = Int +destructure_type(x) = Any +destructure_type(::Type{Union{Nothing,Tuple{<:Any,B}}}) where {B} = B + +infer_nb_iterstate_type(::AbstractSimpleGraph{T}) where {T} = T function infer_nb_iterstate_type(g::AbstractGraph{T}) where {T} - destructure_type(x) = Any - destructure_type(x::Type{Union{Nothing,Tuple{A,B}}}) where {A,B} = B # If no specific dispatch is given, we peek at the first vertex and use Base.Iterator magic to try infering the type. return destructure_type( Base.Iterators.approx_iter_type(typeof(outneighbors(g, one(T))))