Skip to content

Commit

Permalink
Use jl_types_egal in equiv_field_types (#52748)
Browse files Browse the repository at this point in the history
Fixes #52686
Fixes timholy/Revise.jl#770

---------

Co-authored-by: Jameson Nash <[email protected]>
Co-authored-by: Kristoffer Carlsson <[email protected]>
Co-authored-by: Shuhei Kadowaki <[email protected]>
  • Loading branch information
4 people committed Jan 6, 2024
1 parent 6eb535d commit 6a107d0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,7 @@ static int equiv_field_types(jl_value_t *old, jl_value_t *ft)
jl_value_t *ta = jl_svecref(old, i);
jl_value_t *tb = jl_svecref(ft, i);
if (jl_has_free_typevars(ta)) {
if (!jl_has_free_typevars(tb) || !jl_egal(ta, tb))
if (!jl_has_free_typevars(tb) || !jl_types_egal(ta, tb))
return 0;
}
else if (jl_has_free_typevars(tb) || jl_typetagof(ta) != jl_typetagof(tb) ||
Expand Down
15 changes: 15 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,21 @@ let abcd = ABCDconst(1, 2, 3, 4)
abcd.d = nothing)
@test (1, 2, "not constant", 4) === (abcd.a, abcd.b, abcd.c, abcd.d)
end
# Issue #52686
struct A52686{T} end
struct B52686{T, S}
a::A52686{<:T}
end
function func52686()
@eval begin
struct A52686{T} end
struct B52686{T, S}
a::A52686{<:T}
end
end
return true
end
@test func52686()

# test `===` handling null pointer in struct #44712
struct N44712
Expand Down

0 comments on commit 6a107d0

Please sign in to comment.