patch 8.2.0753: Vim9: expressions are evaluated in the discovery phase
Problem: Vim9: expressions are evaluated in the discovery phase.
Solution: Bail out if an expression is not a constant. Require a type for
declared constants.
diff --git a/src/vim.h b/src/vim.h
index 9e4c61d..667e290 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -2133,7 +2133,7 @@
// Flags for assignment functions.
#define LET_IS_CONST 1 // ":const"
#define LET_NO_COMMAND 2 // "var = expr" without ":let" or ":const"
-#define LET_REDEFINE 4 // variable can be redefined later
+#define LET_DISCOVERY 4 // discovery phase: variable can be redefined later
#include "ex_cmds.h" // Ex command defines
#include "spell.h" // spell checking stuff
@@ -2662,4 +2662,8 @@
#define REPTERM_SPECIAL 4
#define REPTERM_NO_SIMPLIFY 8
+// Flags for expression evaluation.
+#define EVAL_EVALUATE 1 // when missing don't actually evaluate
+#define EVAL_CONSTANT 2 // when not a constant return FAIL
+
#endif // VIM__H