Skip to content

Commit 01798fa

Browse files
authored
Revert "unify prod(::Tuple{Vararg{Int}}) with a single method (#57628)" (#57894)
This reverts commit 3d62893. See #57628 (comment) for array indexing regressions
1 parent 638a6a2 commit 01798fa

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

base/tuple.jl

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -649,15 +649,12 @@ reverse(t::Tuple) = revargs(t...)
649649

650650
## specialized reduction ##
651651

652-
# used in bootstrapping
653-
function prod(x::Tuple{Vararg{Int}})
654-
@_terminates_locally_meta
655-
r = 1
656-
for y in x
657-
r *= y
658-
end
659-
r
660-
end
652+
prod(x::Tuple{}) = 1
653+
# This is consistent with the regular prod because there is no need for size promotion
654+
# if all elements in the tuple are of system size.
655+
# It is defined here separately in order to support bootstrap, because it's needed earlier
656+
# than the general prod definition is available.
657+
prod(x::Tuple{Int, Vararg{Int}}) = *(x...)
661658

662659
# a version of `in` esp. for NamedTuple, to make it pure, and not compiled for each tuple length
663660
function sym_in(x::Symbol, itr::Tuple{Vararg{Symbol}})

0 commit comments

Comments
 (0)