From 07c4c274e075b9cbe2afe303a18edbbce5d06153 Mon Sep 17 00:00:00 2001 From: Antony Della Vecchia Date: Wed, 20 Mar 2024 15:37:11 +0100 Subject: [PATCH 1/2] bug fixed --- src/Serialization/containers.jl | 8 ++++++-- test/Serialization/Fields.jl | 27 ++++++++++++++++++--------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/Serialization/containers.jl b/src/Serialization/containers.jl index 128673e7f21d..41d551efc338 100644 --- a/src/Serialization/containers.jl +++ b/src/Serialization/containers.jl @@ -51,7 +51,9 @@ end function load_object(s::DeserializerState, ::Type{<: Vector}, params::Type) load_node(s) do v if serialize_with_id(params) - loaded_v = params[load_ref(s, x) for x in v] + loaded_v::Vector{params} = load_array_node(s) do _ + load_ref(s) + end else loaded_v = params[] for (i, entry) in enumerate(v) @@ -65,7 +67,9 @@ end function load_object(s::DeserializerState, ::Type{<: Vector{params}}) where params load_node(s) do v if serialize_with_id(params) - loaded_v = params[load_ref(s, x) for x in v] + loaded_v = load_array_node(s) do _ + load_ref(s) + end else loaded_v = params[] for (i, entry) in enumerate(v) diff --git a/test/Serialization/Fields.jl b/test/Serialization/Fields.jl index 458c82607252..0d11ec0d275c 100644 --- a/test/Serialization/Fields.jl +++ b/test/Serialization/Fields.jl @@ -1,15 +1,17 @@ @testset "Fields" begin mktempdir() do path + Qx, x = QQ["x"] + K1, _ = number_field(x^2 + 5) + K2, _ = number_field([x^2 + 5, x^2 + 7]) + K3, _ = number_field(x^2 + 7) + Kt, t = polynomial_ring(K1, cached = false) + L1, = number_field(t^2 + 2) + L2, = number_field([t^2 + 2, t^2 + 3]) + Kt, t = polynomial_ring(K2, cached = false) + L3, = number_field(t^2 + 2) + L4, = number_field([t^2 + 2, t^2 + 3]) + @testset "Field Embeddings" begin - Qx, x = QQ["x"] - K1, _ = number_field(x^2 + 5) - K2, _ = number_field([x^2 + 5, x^2 + 7]) - Kt, t = polynomial_ring(K1, cached = false) - L1, = number_field(t^2 + 2) - L2, = number_field([t^2 + 2, t^2 + 3]) - Kt, t = polynomial_ring(K2, cached = false) - L3, = number_field(t^2 + 2) - L4, = number_field([t^2 + 2, t^2 + 3]) for K in (K1, K2, L1, L2, L3, L4) for E in complex_embeddings(K) test_save_load_roundtrip(path, E) do loaded @@ -24,5 +26,12 @@ end end end + + @testset "Vector of Fields" begin + v = [K1, K3] + test_save_load_roundtrip(path, v) do loaded + @test loaded == v + end + end end end From 68db603225fb360630d904e0ecc3fb6914fdf34c Mon Sep 17 00:00:00 2001 From: antonydellavecchia Date: Wed, 20 Mar 2024 15:41:15 +0100 Subject: [PATCH 2/2] Update src/Serialization/containers.jl --- src/Serialization/containers.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Serialization/containers.jl b/src/Serialization/containers.jl index 41d551efc338..8081f034f1d8 100644 --- a/src/Serialization/containers.jl +++ b/src/Serialization/containers.jl @@ -67,7 +67,7 @@ end function load_object(s::DeserializerState, ::Type{<: Vector{params}}) where params load_node(s) do v if serialize_with_id(params) - loaded_v = load_array_node(s) do _ + loaded_v::Vector{params} = load_array_node(s) do _ load_ref(s) end else