Patch 8.2.2660
Problem: Vim9: no error for declaration with trailing text.
Solution: Give an error. (closes #8014)
Files: src/evalvars.c, src/testdir/test_vim9_assign.vim
*** ../vim-8.2.2659/src/evalvars.c 2021-03-14 13:21:31.785065163 +0100
--- src/evalvars.c 2021-03-26 21:24:58.213442399 +0100
***************
*** 789,796 ****
{
if (vim9script)
{
! // Vim9 declaration ":var name: type"
! arg = vim9_declare_scriptvar(eap, arg);
}
else
{
--- 789,799 ----
{
if (vim9script)
{
! if (!ends_excmd2(eap->cmd, skipwhite(argend)))
! semsg(_(e_trailing_arg), argend);
! else
! // Vim9 declaration ":var name: type"
! arg = vim9_declare_scriptvar(eap, arg);
}
else
{
*** ../vim-8.2.2659/src/testdir/test_vim9_assign.vim 2021-03-17 20:56:33.653085748 +0100
--- src/testdir/test_vim9_assign.vim 2021-03-26 21:24:29.861529563 +0100
***************
*** 1290,1295 ****
--- 1290,1297 ----
other = 1234
g:other_var = other
+ var xyz: string # comment
+
# type is inferred
var s:dict = {['a']: 222}
def GetDictVal(key: any)
***************
*** 1365,1371 ****
vim9script
var 9var: string
END
! CheckScriptFailure(lines, 'E475:')
CheckDefFailure(['var foo.bar = 2'], 'E1087:')
CheckDefFailure(['var foo[3] = 2'], 'E1087:')
--- 1367,1373 ----
vim9script
var 9var: string
END
! CheckScriptFailure(lines, 'E488:')
CheckDefFailure(['var foo.bar = 2'], 'E1087:')
CheckDefFailure(['var foo[3] = 2'], 'E1087:')
***************
*** 1617,1622 ****
--- 1619,1629 ----
echo x
END
CheckScriptFailureList(lines, ['E1154:', 'E121:'])
+
+ lines =<< trim END
+ var x: string 'string'
+ END
+ CheckDefAndScriptFailure(lines, 'E488:')
enddef
*** ../vim-8.2.2659/src/version.c 2021-03-26 20:56:42.682749681 +0100
--- src/version.c 2021-03-26 21:21:27.042097684 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2660,
/**/
--
"So this is it," said Arthur, "we are going to die."
"Yes," said Ford, "except...no! Wait a minute!" He suddenly lunged across
the chamber at something behind Arthur's line of vision. "What's this
switch?" he cried.
"What? Where?" cried Arthur, twisting around.
"No, I was only fooling," said Ford, "we are going to die after all."
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
/// Bram Moolenaar -- Br...@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 ///