Skip to content

Commit 25210a4

Browse files
N5N3vtjnash
andcommitted
Delay the free_vararg_length check within intersect_var
We should not skip the `check_unsat_bound`. Co-Authored-By: Jameson Nash <vtjnash+github@gmail.com>
1 parent 5879cda commit 25210a4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/subtype.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,10 +2366,6 @@ static jl_value_t *intersect_var(jl_tvar_t *b, jl_value_t *a, jl_stenv_t *e, int
23662366
ub = (jl_value_t*)b;
23672367
}
23682368
}
2369-
if (has_free_vararg_length(ub, e) && !has_free_vararg_length(a, e)) {
2370-
bb->ub = ub;
2371-
ub = (jl_value_t*)b;
2372-
}
23732369
if (ub != (jl_value_t*)b) {
23742370
if (jl_has_free_typevars(ub)) {
23752371
if (check_unsat_bound(ub, b, e)) {
@@ -2378,6 +2374,11 @@ static jl_value_t *intersect_var(jl_tvar_t *b, jl_value_t *a, jl_stenv_t *e, int
23782374
}
23792375
}
23802376
bb->ub = ub;
2377+
// We get a imprecise Tuple here. Don't change `lb` and return the typevar directly.
2378+
if (has_free_vararg_length(ub, e) && !has_free_vararg_length(a, e)) {
2379+
JL_GC_POP();
2380+
return (jl_value_t*)b;
2381+
}
23812382
bb->lb = ub;
23822383
}
23832384
JL_GC_POP();

0 commit comments

Comments
 (0)