Skip to content

Commit 2568984

Browse files
committed
Don't wrap V<:Vararg in TypeVar(:_, V)
1 parent c92098e commit 2568984

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

base/inference.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ const typeof_tfunc = function (t)
174174
Type{typeof(t)}
175175
end
176176
elseif isa(t,DataType)
177-
if isleaftype(t)
177+
if isleaftype(t) || isvarargtype(t)
178178
Type{t}
179179
else
180180
Type{TypeVar(:_,t)}
@@ -222,7 +222,7 @@ function limit_type_depth(t::ANY, d::Int, cov::Bool, vars)
222222
else
223223
return t
224224
end
225-
if inexact
225+
if inexact && !isvarargtype(R)
226226
R = TypeVar(:_,R)
227227
push!(vars, R)
228228
end
@@ -319,7 +319,7 @@ const fieldtype_tfunc = function (A, s, name)
319319
if is(t,Bottom)
320320
return t
321321
end
322-
Type{exact || isleaftype(t) || isa(t,TypeVar) ? t : TypeVar(:_, t)}
322+
Type{exact || isleaftype(t) || isa(t,TypeVar) || isvarargtype(t) ? t : TypeVar(:_, t)}
323323
end
324324
t_func[fieldtype] = (2, 2, fieldtype_tfunc)
325325
t_func[Box] = (1, 1, (a,)->Box)
@@ -423,7 +423,7 @@ const apply_type_tfunc = function (A, args...)
423423
if type_too_complex(appl,0)
424424
return Type{TypeVar(:_,headtype)}
425425
end
426-
uncertain && !isa(appl,TypeVar) ? Type{TypeVar(:_,appl)} : Type{appl}
426+
uncertain && !(isa(appl,TypeVar) || isvarargtype(appl)) ? Type{TypeVar(:_,appl)} : Type{appl}
427427
end
428428
t_func[apply_type] = (1, Inf, apply_type_tfunc)
429429

@@ -972,7 +972,7 @@ function abstract_eval(e::ANY, vtypes, sv::StaticVarInfo)
972972
# abstract types yield Type{<:T} instead of Type{T}.
973973
# this doesn't really model the situation perfectly, but
974974
# "isleaftype(inference_stack.types)" should be good enough.
975-
if isa(t,TypeVar)
975+
if isa(t,TypeVar) || isvarargtype(t)
976976
t = Type{t}
977977
else
978978
t = Type{TypeVar(:_,t)}

0 commit comments

Comments
 (0)