From 8a81c69e09258d06e4ae92551e5e4cb40030186c Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Thu, 4 Jan 2024 12:44:25 -0600 Subject: [PATCH 1/3] Use `jl_types_egal` in `equiv_field_types` Fixes #52686 Fixes https://github.com/timholy/Revise.jl/issues/770 --- 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 e6472457cb6a9..f8832e0ac952b 100644 --- a/src/builtins.c +++ b/src/builtins.c @@ -1786,7 +1786,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 7245b488624b0..01bccf39d68ae 100644 --- a/test/core.jl +++ b/test/core.jl @@ -111,6 +111,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 +@test begin + # Issue #52686 + mktemp() do f, io + write(io, """ + struct A{T} end + struct B{T, S} + a::A{<:T} + end + """) + close(io) + include(f) + include(f) + end + true +end # test `===` handling null pointer in struct #44712 struct N44712 From f0b3e9cb1a130fc2917c196eeeda22f767d2981d Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Thu, 4 Jan 2024 14:20:06 -0600 Subject: [PATCH 2/3] Update test/core.jl Co-authored-by: Jameson Nash --- test/core.jl | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/core.jl b/test/core.jl index 01bccf39d68ae..ac5c9a59a9a0d 100644 --- a/test/core.jl +++ b/test/core.jl @@ -113,16 +113,13 @@ let abcd = ABCDconst(1, 2, 3, 4) end @test begin # Issue #52686 - mktemp() do f, io - write(io, """ + for i in 1:2 + @eval begin struct A{T} end struct B{T, S} a::A{<:T} end - """) - close(io) - include(f) - include(f) + end end true end From 715ad94380e0964cbba1f3ca0f253975c8de1a6e Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Fri, 5 Jan 2024 11:35:36 +0100 Subject: [PATCH 3/3] Update test/core.jl Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com> --- test/core.jl | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/core.jl b/test/core.jl index ac5c9a59a9a0d..1f66d72c40c5e 100644 --- a/test/core.jl +++ b/test/core.jl @@ -111,18 +111,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 -@test begin - # Issue #52686 - for i in 1:2 - @eval begin - struct A{T} end - struct B{T, S} - a::A{<:T} - 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 - true + return true end +@test func52686() # test `===` handling null pointer in struct #44712 struct N44712