Patch 8.2.4331
Problem:    Vim9: no test for existing script variable in block.
Solution:   Add a test.
Files:      src/testdir/test_vim9_func.vim


*** ../vim-8.2.4330/src/testdir/test_vim9_func.vim      2022-02-07 
21:53:58.089529481 +0000
--- src/testdir/test_vim9_func.vim      2022-02-08 19:22:45.460349680 +0000
***************
*** 1028,1038 ****
      vim9script
      var name = 'piet'
      def FuncOne(name: string)
!       echo nr
      enddef
    END
    v9.CheckScriptFailure(lines, 'E1168:')
  
    # argument name declared later is only found when compiling
    lines =<< trim END
      vim9script
--- 1028,1062 ----
      vim9script
      var name = 'piet'
      def FuncOne(name: string)
!       echo name
      enddef
    END
    v9.CheckScriptFailure(lines, 'E1168:')
  
+   # same, inside the same block
+   lines =<< trim END
+     vim9script
+     if true
+       var name = 'piet'
+       def FuncOne(name: string)
+         echo name
+       enddef
+     endif
+   END
+   v9.CheckScriptFailure(lines, 'E1168:')
+ 
+   # variable in other block is OK
+   lines =<< trim END
+     vim9script
+     if true
+       var name = 'piet'
+     endif
+     def FuncOne(name: string)
+       echo name
+     enddef
+   END
+   v9.CheckScriptSuccess(lines)
+ 
    # argument name declared later is only found when compiling
    lines =<< trim END
      vim9script
*** ../vim-8.2.4330/src/version.c       2022-02-08 19:12:15.260593033 +0000
--- src/version.c       2022-02-08 19:23:19.052327543 +0000
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4331,
  /**/

-- 
How To Keep A Healthy Level Of Insanity:
2. Page yourself over the intercom. Don't disguise your voice.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/20220208192413.DDA561C1905%40moolenaar.net.

Raspunde prin e-mail lui