Skip to content

Commit d06bab0

Browse files
committed
fix #39698 by disabling the unnecessary Vararg var bounds error
backports #39875 to 1.6
1 parent 859577b commit d06bab0

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/jltypes.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,9 +1166,14 @@ static jl_value_t *inst_datatype_inner(jl_datatype_t *dt, jl_svec_t *p, jl_value
11661166
if (jl_is_vararg_type((jl_value_t*)dt) && ntp == 2) {
11671167
jl_value_t *lenparam = iparams[1];
11681168
if (jl_is_typevar(lenparam)) {
1169+
// TODO: this is disabled due to #39698; it is also inconsistent
1170+
// with other similar checks, where we usually only check substituted
1171+
// values and not the bounds of variables.
1172+
/*
11691173
jl_tvar_t *N = (jl_tvar_t*)lenparam;
11701174
if (!(N->lb == jl_bottom_type && N->ub == (jl_value_t*)jl_any_type))
11711175
jl_error("TypeVar in Vararg length must have bounds Union{} and Any");
1176+
*/
11721177
}
11731178
else if (!jl_is_long(lenparam)) {
11741179
jl_type_error_rt("Vararg", "count", (jl_value_t*)jl_long_type, lenparam);

test/core.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3521,9 +3521,6 @@ end
35213521
@test_throws TypeError Union{Int, 1}
35223522

35233523
@test_throws ErrorException Vararg{Any,-2}
3524-
@test_throws ErrorException Vararg{Int, N} where N<:T where T
3525-
@test_throws ErrorException Vararg{Int, N} where N<:Integer
3526-
@test_throws ErrorException Vararg{Int, N} where N>:Integer
35273524

35283525
mutable struct FooNTuple{N}
35293526
z::Tuple{Integer, Vararg{Int, N}}

0 commit comments

Comments
 (0)