Skip to content

Commit af68fc3

Browse files
committed
inference: teach tfunc that typeof tuples must have fixed lengths
1 parent 3624d9d commit af68fc3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

base/compiler/tfuncs.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,13 @@ 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+
nothing
736+
t = Type{Tuple{t.parameters[1:np-1]..., Vararg{p.T, N}}} where N
737+
if isdefined(p, :N)
738+
return t{p.N}
739+
end
740+
return t
736741
end
737742
elseif !isconcretetype(p)
738743
break

0 commit comments

Comments
 (0)