Skip to content
Browse files

improve type inf of tuple(xs...)

  • Loading branch information...
1 parent f988e0e commit 65a1f3dedc7fa3685d69e5c27e3d6c05800ba01b @JeffBezanson JeffBezanson committed Oct 7, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 base/inference.jl
View
13 base/inference.jl
@@ -538,6 +538,19 @@ function abstract_call(f, fargs, argtypes, vtypes, sv::StaticVarInfo, e)
limit_tuple_type(apply(tuple,aargtypes...)) : ()
return abstract_call(_ieval(af), (), at, vtypes, sv, ())
end
+ af = _ieval(af)
+ if is(af,tuple) && length(fargs)==2
+ # tuple(xs...)
+ aat = aargtypes[1]
+ if aat <: AbstractArray
+ # tuple(array...)
+ # TODO: > 1 array of the same type
+ try
+ return (eltype(aat)...)
+ end
+ end
+ return Tuple
+ end
end
end
if is(f,invoke) && length(fargs)>1

0 comments on commit 65a1f3d

Please sign in to comment.
Something went wrong with that request. Please try again.