From e3c1204c2f223070927416e2f436a95eada2358c Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Thu, 9 Sep 2021 15:38:35 +0200
Subject: [PATCH] Clarify auxiliary variable types

Related to https://git.dynare.org/Dynare/dynare/-/issues/1811

(cherry picked from commit 58ee240048d76b5abe4cdddebad29d97591d52c8)
---
 matlab/isauxiliary.m  | 8 ++++----
 matlab/subst_auxvar.m | 6 ++++++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/matlab/isauxiliary.m b/matlab/isauxiliary.m
index 256af69314..796d8dfa18 100644
--- a/matlab/isauxiliary.m
+++ b/matlab/isauxiliary.m
@@ -4,7 +4,7 @@ function b = isauxiliary(var, types)
 %
 % INPUTS
 % - var       [string]    Name of the variable.
-% - types      [integer]  vector of type of auxiliary variables.
+% - types     [integer]  vector of type of auxiliary variables.
 %
 % OUTPUTS
 % - b         [logical]
@@ -20,13 +20,13 @@ function b = isauxiliary(var, types)
 %   -  4     Expectation (substitute for Expectation Operator)
 %   -  5,    Diff forward (substitute for the differentiate of a forward variable)
 %   -  6,    Multipliers for FOC of Ramsey Problem
-%   -  7,    Variable for var_model with order > abs(min_lag()) present in model
+%   -  7,    currently not used, see SymbolTable.hh
 %   -  8,    Variable for Diff operator
 %   -  9,    Lag on Diff
-%   - 10,    Unary operator (log, exp)
+%   - 10,    Variable created when diff was taken of unary operator (log, exp)
 %   - 11,    Lead on Diff
 
-% Copyright (C) 2018-2019 Dynare Team
+% Copyright (C) 2018-2021 Dynare Team
 %
 % This file is part of Dynare.
 %
diff --git a/matlab/subst_auxvar.m b/matlab/subst_auxvar.m
index a5d2781e4b..43aeff4434 100644
--- a/matlab/subst_auxvar.m
+++ b/matlab/subst_auxvar.m
@@ -60,6 +60,9 @@ if ~isempty(aux_index)
                 str = sprintf('%s', M_.endo_names{M_.aux_vars(aux_index).endo_index});
             end
             return
+        case 7
+            % currently unused
+            error('This type of auxiliary variable should not occur, please contact the developers.')
         case 8
             % Diff operator
             str = sprintf('diff(%s)', M_.endo_names{M_.aux_vars(aux_index).orig_index});
@@ -74,6 +77,9 @@ if ~isempty(aux_index)
             end
             str = sprintf('diff(%s(-%u))', M_.endo_names{M_.aux_vars(j).orig_index}, lags);
             return
+        case 10
+            % Variable created when diff was taken of unary operator (log, exp)
+            error('This type of auxiliary variable should not occur, please contact the developers.')
         case 11
             % Leaded diff
             leads = 0;
-- 
GitLab