Skip to content

Commit

Permalink
fix #39698 by disabling the unnecessary Vararg var bounds error
Browse files Browse the repository at this point in the history
backports #39875 to 1.6
  • Loading branch information
JeffBezanson committed Mar 3, 2021
1 parent 859577b commit d06bab0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1166,9 +1166,14 @@ static jl_value_t *inst_datatype_inner(jl_datatype_t *dt, jl_svec_t *p, jl_value
if (jl_is_vararg_type((jl_value_t*)dt) && ntp == 2) {
jl_value_t *lenparam = iparams[1];
if (jl_is_typevar(lenparam)) {
// TODO: this is disabled due to #39698; it is also inconsistent
// with other similar checks, where we usually only check substituted
// values and not the bounds of variables.
/*
jl_tvar_t *N = (jl_tvar_t*)lenparam;
if (!(N->lb == jl_bottom_type && N->ub == (jl_value_t*)jl_any_type))
jl_error("TypeVar in Vararg length must have bounds Union{} and Any");
*/
}
else if (!jl_is_long(lenparam)) {
jl_type_error_rt("Vararg", "count", (jl_value_t*)jl_long_type, lenparam);
Expand Down
3 changes: 0 additions & 3 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3521,9 +3521,6 @@ end
@test_throws TypeError Union{Int, 1}

@test_throws ErrorException Vararg{Any,-2}
@test_throws ErrorException Vararg{Int, N} where N<:T where T
@test_throws ErrorException Vararg{Int, N} where N<:Integer
@test_throws ErrorException Vararg{Int, N} where N>:Integer

mutable struct FooNTuple{N}
z::Tuple{Integer, Vararg{Int, N}}
Expand Down

0 comments on commit d06bab0

Please sign in to comment.