From ba9d205dccec81f121532b77e63ea0b70bff61ae Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Wed, 4 May 2022 13:05:27 +0200
Subject: [PATCH] model_diagnostics.m: add check for potential naming conflict

(cherry picked from commit 737524d1826d7ac0f981a4fe7a34770e03a0ec32)
---
 matlab/model_diagnostics.m | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/matlab/model_diagnostics.m b/matlab/model_diagnostics.m
index 25552465c3..c1f7b0e1e5 100644
--- a/matlab/model_diagnostics.m
+++ b/matlab/model_diagnostics.m
@@ -59,6 +59,27 @@ if options.ramsey_policy
 end
 
 problem_dummy=0;
+
+%naming conflict in steady state file
+if options.steadystate_flag == 1
+    if strmatch('ys',M.endo_names,'exact') 
+        disp(['MODEL_DIAGNOSTICS: using the name ys for an endogenous variable will typically conflict with the internal naming in user-defined steady state files.'])
+        problem_dummy=1;
+    end
+    if strmatch('ys',M.param_names,'exact')
+        disp(['MODEL_DIAGNOSTICS: using the name ys for a parameter will typically conflict with the internal naming in user-defined steady state files.'])
+        problem_dummy=1;
+    end
+    if strmatch('M_',M.endo_names,'exact') 
+        disp(['MODEL_DIAGNOSTICS: using the name M_ for an endogenous variable will typically conflict with the internal naming in user-defined steady state files.'])
+        problem_dummy=1;
+    end
+    if strmatch('M_',M.param_names,'exact')
+        disp(['MODEL_DIAGNOSTICS: using the name M_ for a parameter will typically conflict with the internal naming in user-defined steady state files.'])
+        problem_dummy=1;
+    end
+end
+
 %
 % missing variables at the current period
 %
-- 
GitLab