From 71349b72c9303fb864a349818f8b126c5aec21df Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Wed, 15 Sep 2021 12:46:28 -0400 Subject: [PATCH] avoid `Any32` type in `filter` for tuples. fixes #42236 --- base/tuple.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/tuple.jl b/base/tuple.jl index 77fa6ba0ea1a3..597a5629efa90 100644 --- a/base/tuple.jl +++ b/base/tuple.jl @@ -356,10 +356,10 @@ end ## filter ## -filter(f, xs::Tuple) = afoldl((ys, x) -> f(x) ? (ys..., x) : ys, (), xs...) +filter_rec(f, xs::Tuple) = afoldl((ys, x) -> f(x) ? (ys..., x) : ys, (), xs...) # use Array for long tuples -filter(f, t::Any32) = Tuple(filter(f, collect(t))) +filter(f, t::Tuple) = length(t) < 32 ? filter_rec(f, t) : Tuple(filter(f, collect(t))) ## comparison ##