From 8e35f6b216b2f20e751bb186992365df1f037216 Mon Sep 17 00:00:00 2001 From: "James P. Fairbanks" Date: Wed, 30 Aug 2023 09:39:41 -0400 Subject: [PATCH] BUG: debugging PR #13 --- src/SyntacticModels.jl | 4 +++- test/core.jl | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/SyntacticModels.jl b/src/SyntacticModels.jl index 7b8f02f..12d9290 100644 --- a/src/SyntacticModels.jl +++ b/src/SyntacticModels.jl @@ -51,7 +51,9 @@ include("composite_models.jl") #-----------------------------------------------------------------------------# Constructors for T in concrete_subtypes(AbstractTerm) @eval function $(parentmodule(T)).$(T.name.name)(x::NamedTuple) - args = x[fieldnames($T)] + fields = filter(x -> x != :_type, fieldnames($T)) + args = collect(x[fields]) + @show args $(parentmodule(T)).$(T.name.name)(args...) end end diff --git a/test/core.jl b/test/core.jl index 55f9996..600eaf5 100644 --- a/test/core.jl +++ b/test/core.jl @@ -9,7 +9,7 @@ using JSON3 jsondir = joinpath(@__DIR__, "json") write_json_model(m, prefix=joinpath(@__DIR__, "json")) = open(joinpath(prefix, "$(m.header.name).json"), "w") do fp - JSON3.pretty(fp, Dict(m)) + JSON3.pretty(fp, m) end readback(m, prefix=joinpath(@__DIR__, "json")) = open(joinpath(jsondir, "$(m.header.name).json"), "r") do fp