Skip to content

Commit 00c6ea7

Browse files
committed
inference: teach tfunc that typeof tuples must have fixed lengths
1 parent 8307dbf commit 00c6ea7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

base/compiler/tfuncs.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,12 @@ function typeof_concrete_vararg(t::DataType)
731731
for i = 1:np
732732
p = t.parameters[i]
733733
if i == np && isvarargtype(p)
734-
if isdefined(p, :T) && !isdefined(p, :N) && isconcretetype(p.T)
735-
return Type{Tuple{t.parameters[1:np-1]..., Vararg{p.T, N}}} where N
734+
if isdefined(p, :T) && isconcretetype(p.T)
735+
t = Type{Tuple{t.parameters[1:np-1]..., Vararg{p.T, N}}} where N
736+
if isdefined(p, :N)
737+
return t{p.N}
738+
end
739+
return t
736740
end
737741
elseif !isconcretetype(p)
738742
break

0 commit comments

Comments
 (0)