Patch 8.2.1450
Problem:    Vim9: no check that script-local items don't become global.
Solution:   Add a test.
Files:      src/testdir/test_vim9_script.vim


*** ../vim-8.2.1449/src/testdir/test_vim9_script.vim    2020-08-14 
17:08:12.008859508 +0200
--- src/testdir/test_vim9_script.vim    2020-08-14 20:50:11.019468304 +0200
***************
*** 3039,3044 ****
--- 3039,3080 ----
    delete('Xvim9_script.vim')
  enddef
  
+ func Test_vim9script_not_global()
+   " check that items defined in Vim9 script are script-local, not global
+   let vim9lines =<< trim END
+     vim9script
+     let var = 'local'
+     func TheFunc()
+       echo 'local'
+     endfunc
+     def DefFunc()
+       echo 'local'
+     enddef
+   END
+   call writefile(vim9lines, 'Xvim9script.vim')
+   source Xvim9script.vim
+   try
+     echo g:var
+     assert_report('did not fail')
+   catch /E121:/
+     " caught
+   endtry
+   try
+     call TheFunc()
+     assert_report('did not fail')
+   catch /E117:/
+     " caught
+   endtry
+   try
+     call DefFunc()
+     assert_report('did not fail')
+   catch /E117:/
+     " caught
+   endtry
+ 
+   call delete('Xvim9script.vium')
+ endfunc
+ 
  def Test_vim9_copen()
    # this was giving an error for setting w:quickfix_title
    copen
*** ../vim-8.2.1449/src/version.c       2020-08-14 19:20:19.790506736 +0200
--- src/version.c       2020-08-14 20:51:28.682903365 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1450,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
200. You really believe in the concept of a "paperless" office.

 /// Bram Moolenaar -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202008141852.07EIqvKU125589%40masaka.moolenaar.net.

Raspunde prin e-mail lui