commit ed01ef7fa5c2611748f90acfdc2145b22629dc36
parent 7404c6010dd7abd4339a4ffd6961f2a420fe7ddb
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sun, 6 Nov 2022 15:11:48 +0800
vim-patch:9.0.0355: check for uppercase char in autoload name is wrong
Problem: Check for uppercase char in autoload name is wrong, it checks the
name of the script.
Solution: Remove the check. (closes vim/vim#11031)
https://github.com/vim/vim/commit/6c667bdc9489963102bd6c46b1b73e4d43c034ce
Co-authored-by: thinca <thinca@gmail.com>
Diffstat:
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c
@@ -1453,9 +1453,10 @@ bool var_wrong_func_name(const char *const name, const bool new_var)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
{
// Allow for w: b: s: and t:.
+ // Allow autoload variable.
if (!(vim_strchr("wbst", name[0]) != NULL && name[1] == ':')
- && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':')
- ? name[2] : name[0])) {
+ && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') ? name[2] : name[0])
+ && vim_strchr(name, '#') == NULL) {
semsg(_("E704: Funcref variable name must start with a capital: %s"), name);
return true;
}
diff --git a/src/nvim/testdir/test_let.vim b/src/nvim/testdir/test_let.vim
@@ -6,6 +6,10 @@ func Test_let()
let Test104#numvar = function('tr')
call assert_equal("function('tr')", string(Test104#numvar))
+ let foo#tr = function('tr')
+ call assert_equal("function('tr')", string(foo#tr))
+ unlet foo#tr
+
let a = 1
let b = 2