From cac24dad7edbbdcce657de484d4e2844b43a48ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Mon, 6 Dec 2021 15:35:01 +0100
Subject: [PATCH] Substitute model-local variables in equations marked [static]

(cherry picked from commit 8d4cab6fe3228289046c38221eaabb71c9e7479a)
---
 src/DynamicModel.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index 2c034b55..d50ee73f 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -5677,6 +5677,9 @@ DynamicModel::substituteModelLocalVariables()
   for (auto &equation : equations)
     equation = dynamic_cast<BinaryOpNode *>(equation->substituteModelLocalVariables());
 
+  for (auto &equation : static_only_equations)
+    equation = dynamic_cast<BinaryOpNode *>(equation->substituteModelLocalVariables());
+
   /* We can’t clear local_variables_table at this point, because in case of
      ramsey_policy, the original model is saved via DynamicModel::operator=()
      before computing the FOC. But since DataTree::operator=() clones all
-- 
GitLab