Skip to content

Commit

Permalink
sharpen the result of tmerge() for Tuple types
Browse files Browse the repository at this point in the history
change a comprehension in Pkg.Reqs.Requirement that depended on type
inference. due to `call` constructors we simply cannot get its type
anymore, although the other change in this commit helps a lot.
  • Loading branch information
JeffBezanson committed Oct 17, 2014
1 parent e5cbd8f commit 4ee2b41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,10 @@ function tmerge(typea::ANY, typeb::ANY)
if typeb <: typea
return typea
end
if typea <: Tuple && typeb <: Tuple
if isa(typea, Tuple) && isa(typeb, Tuple)
if length(typea) == length(typeb) && !isvatuple(typea) && !isvatuple(typeb)
return typejoin(typea, typeb)
end
return Tuple
end
u = Union(typea, typeb)
Expand Down
2 changes: 1 addition & 1 deletion base/pkg/reqs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ immutable Requirement <: Line
package = shift!(fields)
all(field->ismatch(Base.VERSION_REGEX, field), fields) ||
error("invalid requires entry for $package: $content")
versions = [VersionNumber(field) for field in fields]
versions = VersionNumber[fields...]
issorted(versions) || error("invalid requires entry for $package: $content")
new(content, package, VersionSet(versions), system)
end
Expand Down

0 comments on commit 4ee2b41

Please sign in to comment.