From 46f401b26e42bbe763f445f4dafe47566f568feb Mon Sep 17 00:00:00 2001 From: MilesCranmer Date: Wed, 25 Dec 2024 21:44:51 -0500 Subject: [PATCH] test: fix JET error with type assertion --- src/TemplateExpression.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/TemplateExpression.jl b/src/TemplateExpression.jl index 53e9eedd..cc88205a 100644 --- a/src/TemplateExpression.jl +++ b/src/TemplateExpression.jl @@ -390,7 +390,7 @@ function DE.allocate_container(e::TemplateExpression, n::Union{Nothing,Integer}= parameters = get_metadata(e).parameters return PreallocatedTemplateExpression( NamedTuple{keys(ts)}(map(t -> DE.allocate_container(t, n), values(ts))), - has_params(e) ? similar(parameters) : nothing, + has_params(e) ? similar(parameters::ParamVector) : nothing, ) end function DE.copy_into!(dest::PreallocatedTemplateExpression, src::TemplateExpression) @@ -398,7 +398,7 @@ function DE.copy_into!(dest::PreallocatedTemplateExpression, src::TemplateExpres parameters = get_metadata(src).parameters new_contents = NamedTuple{keys(ts)}(map(DE.copy_into!, values(dest.trees), values(ts))) if has_params(src) - dest.parameters[:] = parameters[:] + (dest.parameters::ParamVector)[:] = (parameters::ParamVector)[:] end return with_metadata( with_contents(src, new_contents); @@ -723,7 +723,7 @@ function MF.mutate_constant( idx_to_mutate = StatsBase.sample( rng, 1:num_params, num_params_to_mutate; replace=false ) - parameters = get_metadata(ex).parameters + parameters = get_metadata(ex).parameters::ParamVector factors = [MF.mutate_factor(T, temperature, options, rng) for _ in idx_to_mutate] @inbounds for (i, f) in zip(idx_to_mutate, factors) parameters._data[i] *= f