From 79a98f2906b487982ab8adc2af7c9947d87e3329 Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Fri, 8 Mar 2024 11:53:54 +0100 Subject: [PATCH] Revert "Use recursion to fix inference failure with tuples (#78)" This reverts commit e1ef21b8fcdb380d051a1428592e888c727a26fe. --- src/base.jl | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/base.jl b/src/base.jl index e4c6dd0..6a55250 100644 --- a/src/base.jl +++ b/src/base.jl @@ -1,13 +1,6 @@ # predefined adaptors for working with types from the Julia standard library -# Use recursion to avoid inference bail-out in `map` -#adapt_structure(to, xs::Union{Tuple,NamedTuple}) = map(adapt(to), xs) -adapt_structure(to, xs::NamedTuple) = map(adapt(to), xs) -adapt_structure(to, xs::Tuple) = _adapt_tuple_structure(to, xs) -_adapt_tuple_structure(to, xs::Tuple) = - (adapt(to, first(xs)), _adapt_tuple_structure(to, Base.tail(xs))...) -_adapt_tuple_structure(to, xs::Tuple{}) = () -_adapt_tuple_structure(to, xs::Tuple{<:Any}) = (adapt(to, first(xs)), ) +adapt_structure(to, xs::Union{Tuple,NamedTuple}) = map(adapt(to), xs) ## Closures