Skip to content

Commit

Permalink
fix unlimited_type_size growth of Tuple
Browse files Browse the repository at this point in the history
widen Tuple faster, to Any, if it's already nesting
  • Loading branch information
vtjnash committed Jan 19, 2018
1 parent 0379a38 commit ad703e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions base/compiler/typelimits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ function _limit_type_size(@nospecialize(t), @nospecialize(c), sources::SimpleVec
# never replace Vararg with non-Vararg
return Vararg
end
if allowed_tuplelen < 1 && t.name === Tuple.name
return Any
end
widert = t.name.wrapper
if !(t <: widert)
# This can happen when a typevar has bounds too wide for its context, e.g.
Expand Down
4 changes: 2 additions & 2 deletions test/compiler/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ let comparison = Tuple{X, X} where X<:Tuple
sig = Tuple{X, X} where X<:comparison
ref = Tuple{X, X} where X
@test Core.Compiler.limit_type_size(sig, comparison, comparison, 10) == comparison
@test Core.Compiler.limit_type_size(sig, ref, comparison, 10) == comparison
@test Core.Compiler.limit_type_size(Tuple{sig}, Tuple{ref}, comparison, 10) == Tuple{comparison}
@test Core.Compiler.limit_type_size(sig, ref, comparison, 10) == ref
@test Core.Compiler.limit_type_size(Tuple{sig}, Tuple{ref}, comparison, 10) == Tuple{ref}
@test Core.Compiler.limit_type_size(sig, ref, Tuple{comparison}, 10) == sig
end

Expand Down

0 comments on commit ad703e8

Please sign in to comment.