From d65911b7bc09b300a6c6c53b8f353c7f3447021e Mon Sep 17 00:00:00 2001 From: Simone Carlo Surace Date: Tue, 6 Feb 2024 13:30:51 +0100 Subject: [PATCH] Add method `value(::Nothing)` --- src/parameters_base.jl | 1 + test/parameters.jl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/parameters_base.jl b/src/parameters_base.jl index 61c17d4..dfbc54d 100644 --- a/src/parameters_base.jl +++ b/src/parameters_base.jl @@ -18,3 +18,4 @@ value(x::AbstractArray) = map(value, x) value(x::Tuple) = map(value, x) value(x::NamedTuple) = map(value, x) value(x::Dict) = Dict(k => value(v) for (k, v) in x) +value(::Nothing) = nothing diff --git a/test/parameters.jl b/test/parameters.jl index 6f8e17a..7df5d2d 100644 --- a/test/parameters.jl +++ b/test/parameters.jl @@ -62,7 +62,7 @@ end @testset "value_flatten" begin - x = (ones(3), fixed(5.0), (a=fixed(5.0), b=[6.0, 2.1])) + x = (ones(3), fixed(5.0), (a=fixed(5.0), b=[6.0, 2.1]), nothing) v, unflatten = value_flatten(x) @test length(v) == 5