Files
neovim/test
zeertzjq 5a7df03b42 vim-patch:9.2.0265: unnecessary restrictions for defining dictionary function names (#38524)
Problem:  unnecessary restrictions for defining dictionary function
          names
Solution: Allow defining dict function with bracket key that is not a
          valid identifier (thinca)

In Vim script, "function obj.func()" and "function obj['func']()" both
define a dictionary function.  However, the bracket form required the
key to match function naming rules (eval_isnamec), so
"function obj['foo-bar']()" failed with E475.

Assigning and calling already work: "let obj['foo-bar'] = obj.func"
and "call obj['foo-bar']()" are valid.  Only the definition was
incorrectly restricted.

Skip the identifier check when the name comes from fd_newkey (i.e. the
key was given in bracket notation).  Dictionary keys may be any string.

Supported by AI

closes: vim/vim#19833

f89662722d

Co-authored-by: thinca <thinca@gmail.com>
2026-03-28 18:51:00 +08:00
..
2024-08-11 15:14:14 +01:00