Skip to content

Commit

Permalink
Revert "Use recursion to fix inference failure with tuples (#78)" (#80)
Browse files Browse the repository at this point in the history
This reverts commit e1ef21b.
  • Loading branch information
maleadt authored Mar 8, 2024
1 parent 3d7097a commit e99bc55
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/base.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit e99bc55

Please sign in to comment.