Patch 8.2.1286
Problem: Vim9: No error when using a type to a window variable
Solution: Recognize the syntax and give an error. (closes #6521)
Files: src/ex_docmd.c, src/testdir/test_vim9_script.vim
*** ../vim-8.2.1285/src/ex_docmd.c 2020-07-23 17:16:15.050100601 +0200
--- src/ex_docmd.c 2020-07-23 21:07:45.909495700 +0200
***************
*** 3324,3329 ****
--- 3324,3337 ----
return eap->cmd;
}
}
+
+ // Recognize using a type for a w:, b:, t: or g: variable:
+ // "w:varname: number = 123".
+ if (eap->cmd[1] == ':' && *p == ':')
+ {
+ eap->cmdidx = CMD_eval;
+ return eap->cmd;
+ }
}
#endif
*** ../vim-8.2.1285/src/testdir/test_vim9_script.vim 2020-07-23 13:11:33.247754399 +0200
--- src/testdir/test_vim9_script.vim 2020-07-23 21:12:46.624346066 +0200
***************
*** 376,381 ****
--- 376,390 ----
call assert_fails('s/^/\=Mess()/n', 'E794:')
call CheckDefFailure(['let var: dict<number'], 'E1009:')
+
+ call CheckDefFailure(['w:foo: number = 10'],
+ 'E488: Trailing characters: : number = 1')
+ call CheckDefFailure(['t:foo: bool = true'],
+ 'E488: Trailing characters: : bool = true')
+ call CheckDefFailure(['b:foo: string = "x"'],
+ 'E488: Trailing characters: : string = "x"')
+ call CheckDefFailure(['g:foo: number = 123'],
+ 'E488: Trailing characters: : number = 123')
enddef
def Test_unlet()
*** ../vim-8.2.1285/src/version.c 2020-07-23 20:56:01.215470359 +0200
--- src/version.c 2020-07-23 21:08:54.477242634 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1286,
/**/
--
hundred-and-one symptoms of being an internet addict:
77. The phone company asks you to test drive their new PBX system
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///