diff --git a/base/reflection.jl b/base/reflection.jl index 6385103b8fb02..e8a709db49648 100644 --- a/base/reflection.jl +++ b/base/reflection.jl @@ -686,6 +686,10 @@ function fieldcount(@nospecialize t) end return length(t.name.names) end +# Add an overload for Tuples, where we can determine this much more cheaply than for other types. +function fieldcount(@nospecialize t::Type{T}) where T<:Tuple{Vararg{Any,N}} where N + N +end """ fieldtypes(T::Type)