To: vim_dev@googlegroups.com Subject: Patch 8.2.2673 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2673 Problem: Vim9: script-local funcref can have lower case name. Solution: Require an upper case name. Files: src/evalvars.c, src/testdir/test_vim9_assign.vim *** ../vim-8.2.2672/src/evalvars.c 2021-03-26 21:27:48.580922728 +0100 --- src/evalvars.c 2021-03-28 21:00:52.317070088 +0200 *************** *** 3453,3460 **** char_u *name, // points to start of variable name int new_var) // TRUE when creating the variable { ! // Allow for w: b: s: and t:. ! if (!(vim_strchr((char_u *)"wbst", name[0]) != NULL && name[1] == ':') && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') ? name[2] : name[0])) { --- 3453,3462 ---- char_u *name, // points to start of variable name int new_var) // TRUE when creating the variable { ! // Allow for w: b: s: and t:. In Vim9 script s: is not allowed, because ! // the name can be used without the s: prefix. ! if (!((vim_strchr((char_u *)"wbt", name[0]) != NULL ! || (!in_vim9script() && name[0] == 's')) && name[1] == ':') && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') ? name[2] : name[0])) { *** ../vim-8.2.2672/src/testdir/test_vim9_assign.vim 2021-03-26 21:27:48.580922728 +0100 --- src/testdir/test_vim9_assign.vim 2021-03-28 21:03:55.552587349 +0200 *************** *** 1654,1658 **** --- 1654,1684 ---- CheckDefAndScriptSuccess(lines) enddef + def Test_script_funcref_case() + var lines =<< trim END + var Len = (s: string): number => len(s) + 1 + assert_equal(5, Len('asdf')) + END + CheckDefAndScriptSuccess(lines) + + lines =<< trim END + var len = (s: string): number => len(s) + 1 + END + CheckDefAndScriptFailure(lines, 'E704:') + + lines =<< trim END + vim9script + var s:Len = (s: string): number => len(s) + 2 + assert_equal(6, Len('asdf')) + END + CheckScriptSuccess(lines) + + lines =<< trim END + vim9script + var s:len = (s: string): number => len(s) + 1 + END + CheckScriptFailure(lines, 'E704:') + enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker *** ../vim-8.2.2672/src/version.c 2021-03-28 20:38:30.540591499 +0200 --- src/version.c 2021-03-28 20:51:44.678523310 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2673, /**/ -- hundred-and-one symptoms of being an internet addict: 33. You name your children Eudora, Mozilla and Dotcom. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///