Skip to content

Commit b9b106c

Browse files
vtjnashKristofferC
authored andcommitted
handle unbound vars in NTuple fields (#55405)
Comparing objects by `==` will happily answer nonsense for malformed type comparisons, such as `unwrap_unionall(A) == A`. Avoid forming that query. Additionally, need to recourse through Vararg when examining type structure to make decisions. Fix #55076 Fix #55189 (cherry picked from commit 32423a8)
1 parent e5cc6ee commit b9b106c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/builtins.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,6 +1715,12 @@ static int references_name(jl_value_t *p, jl_typename_t *name, int affects_layou
17151715
return references_name(((jl_uniontype_t*)p)->a, name, affects_layout, freevars) ||
17161716
references_name(((jl_uniontype_t*)p)->b, name, affects_layout, freevars);
17171717
}
1718+
if (jl_is_vararg(p)) {
1719+
jl_value_t *T = ((jl_vararg_t*)p)->T;
1720+
jl_value_t *N = ((jl_vararg_t*)p)->N;
1721+
return (T && references_name(T, name, affects_layout, freevars)) ||
1722+
(N && references_name(N, name, affects_layout, freevars));
1723+
}
17181724
if (jl_is_typevar(p))
17191725
return 0; // already checked by unionall, if applicable
17201726
if (jl_is_datatype(p)) {

0 commit comments

Comments
 (0)