Skip to content

Commit 1e3bd52

Browse files
vtjnashKristofferC
authored andcommitted
codegen: fix unswitchtupleunion for empty Tuple{}
Fixes #42579 Backports relevant line from #39754 (2e21b38)
1 parent d3b7f3d commit 1e3bd52

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

base/compiler/typeutils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ function unswitchtupleunion(u::Union)
216216
ts = uniontypes(u)
217217
n = -1
218218
for t in ts
219-
if t isa DataType && t.name === Tuple.name && !isvarargtype(t.parameters[end])
219+
if t isa DataType && t.name === Tuple.name && length(t.parameters) != 0 && !isvarargtype(t.parameters[end])
220220
if n == -1
221221
n = length(t.parameters)
222222
elseif n != length(t.parameters)

0 commit comments

Comments
 (0)