Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Improve tuple subtyping in invariant position #18451

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2670,6 +2670,8 @@ static int jl_tuple_subtype_(jl_value_t **child, size_t clenr,
if (jl_is_vararg_type(pe)) pe = jl_tparam0(pe);
}

if (invariant && jl_is_typevar(pe) && !((jl_tvar_t*)pe)->bound && !jl_is_typevar(ce))
break;
if (!jl_subtype_le(ce, pe, ta, invariant))
break;

Expand Down
4 changes: 4 additions & 0 deletions test/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,7 @@ function test18399(C)
return hvcat18399(((2, 3),))
end
@test test18399(C18399) == (2, 3)

# issue #18450
f18450() = ifelse(true, Tuple{Vararg{Int}}, Tuple{Vararg})
@test f18450() = Tuple{Vararg{Int}}
Copy link
Contributor

@yuyichao yuyichao Sep 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

==

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. I should run tests locally first.