From 92d9a62dd380daf389d9036907072871e6d73505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Mon, 11 Oct 2010 14:49:23 +0200 Subject: [PATCH] Preprocessor: give more explicit error message when lead or lag is used inside 'planner_objective' --- preprocessor/ParsingDriver.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/preprocessor/ParsingDriver.cc b/preprocessor/ParsingDriver.cc index 4b6a663df..6f17788b7 100644 --- a/preprocessor/ParsingDriver.cc +++ b/preprocessor/ParsingDriver.cc @@ -235,6 +235,9 @@ ParsingDriver::add_model_variable(int symb_id, int lag) if (type == eModelLocalVariable && lag != 0) error("Model local variable " + mod_file->symbol_table.getName(symb_id) + " cannot be given a lead or a lag."); + if (dynamic_cast(model_tree) != NULL && lag != 0) + error("Leads and lags on variables are forbidden in 'planner_objective'."); + // It makes sense to allow a lead/lag on parameters: during steady state calibration, endogenous and parameters can be swapped return model_tree->AddVariable(symb_id, lag); }