patch 8.2.4589: cannot index the g: dictionary
Problem: Cannot index the g: dictionary.
Solution: Recognize using "g:[key]". (closes #9969)
diff --git a/src/eval.c b/src/eval.c
index 3f6be18..8d1e4fd 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -929,7 +929,8 @@
if (vim9script)
{
// "a: type" is declaring variable "a" with a type, not "a:".
- if (p == name + 2 && p[-1] == ':')
+ // However, "g:[key]" is indexing a dictionary.
+ if (p == name + 2 && p[-1] == ':' && *p != '[')
{
--p;
lp->ll_name_end = p;