Skip to content

Commit

Permalink
Don't wrap V<:Vararg in TypeVar(:_, V)
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed May 18, 2015
1 parent 2d3e02a commit 80b0032
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const typeof_tfunc = function (t)
Type{typeof(t)}
end
elseif isa(t,DataType)
if isleaftype(t)
if isleaftype(t) || isvarargtype(t)
Type{t}
else
Type{TypeVar(:_,t)}
Expand Down Expand Up @@ -222,7 +222,7 @@ function limit_type_depth(t::ANY, d::Int, cov::Bool, vars)
else
return t
end
if inexact
if inexact && !isvarargtype(R)
R = TypeVar(:_,R)
push!(vars, R)
end
Expand Down Expand Up @@ -319,7 +319,7 @@ const fieldtype_tfunc = function (A, s, name)
if is(t,Bottom)
return t
end
Type{exact || isleaftype(t) || isa(t,TypeVar) ? t : TypeVar(:_, t)}
Type{exact || isleaftype(t) || isa(t,TypeVar) || isvarargtype(t) ? t : TypeVar(:_, t)}
end
t_func[fieldtype] = (2, 2, fieldtype_tfunc)
t_func[Box] = (1, 1, (a,)->Box)
Expand Down Expand Up @@ -423,7 +423,7 @@ const apply_type_tfunc = function (A, args...)
if type_too_complex(appl,0)
return Type{TypeVar(:_,headtype)}
end
uncertain && !isa(appl,TypeVar) ? Type{TypeVar(:_,appl)} : Type{appl}
uncertain && !(isa(appl,TypeVar) || isvarargtype(appl)) ? Type{TypeVar(:_,appl)} : Type{appl}
end
t_func[apply_type] = (1, Inf, apply_type_tfunc)

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

0 comments on commit 80b0032

Please sign in to comment.