From 6a107d082cd403fbb42cd7585acc021be39611e3 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Sat, 6 Jan 2024 00:09:43 -0600 Subject: [PATCH] Use `jl_types_egal` in `equiv_field_types` (#52748) Fixes #52686 Fixes https://github.com/timholy/Revise.jl/issues/770 --------- Co-authored-by: Jameson Nash Co-authored-by: Kristoffer Carlsson Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com> --- src/builtins.c | 2 +- test/core.jl | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/builtins.c b/src/builtins.c index e2169abb704fc..6d32c439d5b6e 100644 --- a/src/builtins.c +++ b/src/builtins.c @@ -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) || diff --git a/test/core.jl b/test/core.jl index 0e58b7e157fde..34d0e762e2ec1 100644 --- a/test/core.jl +++ b/test/core.jl @@ -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