Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix eltype of flatten of tuple with non-2 length #56802

Merged
merged 7 commits into from
Dec 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use foldable meta?
  • Loading branch information
jakobnissen committed Dec 11, 2024
commit d084db47a9b0b2361b326454dfe2d4473107eab4
8 changes: 4 additions & 4 deletions base/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const Base = parentmodule(@__MODULE__)
using .Base:
@inline, Pair, Pairs, AbstractDict, IndexLinear, IndexStyle, AbstractVector, Vector,
SizeUnknown, HasLength, HasShape, IsInfinite, EltypeUnknown, HasEltype, OneTo,
@propagate_inbounds, @isdefined, @boundscheck, @inbounds, Generator, IdDict,
@propagate_inbounds, @isdefined, @boundscheck, @inbounds, @_foldable_meta,
Generator, IdDict,
AbstractRange, AbstractUnitRange, UnitRange, LinearIndices, TupleOrBottom,
(:), |, +, -, *, !==, !, ==, !=, <=, <, >, >=, =>, missing,
any, _counttuple, eachindex, ntuple, zero, prod, reduce, in, firstindex, lastindex,
Expand Down Expand Up @@ -1205,9 +1206,8 @@ eltype(::Type{Flatten{I}}) where {I} = eltype(eltype(I))

# For tuples, we statically know the element type of each index, so we can compute
# this at compile time.
Base.@assume_effects :foldable function eltype(
::Type{Flatten{I}}
) where {I<:Union{Tuple,NamedTuple}}
function eltype(::Type{Flatten{I}}) where {I<:Union{Tuple,NamedTuple}}
@_foldable_meta
T = Union{}
for i in fieldtypes(I)
T = Base.promote_typejoin(T, eltype(i))
Expand Down
Loading