diff src/testdir/test_vim9_func.vim @ 23565:34aa2907082a v8.2.2325

patch 8.2.2325: Vim9: crash if map() changes the item type Commit: https://github.com/vim/vim/commit/75ab91ff3403e725a79ac9c7351b78e9aff71d67 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 10 22:42:50 2021 +0100 patch 8.2.2325: Vim9: crash if map() changes the item type Problem: Vim9: crash if map() changes the item type. Solution: Check that the item type is still OK. (closes https://github.com/vim/vim/issues/7652) Fix problem with mapnew() on range list.
author Bram Moolenaar <Bram@vim.org>
date Sun, 10 Jan 2021 22:45:06 +0100
parents 64dfb69e7d46
children ca98d85e92da
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -1763,7 +1763,7 @@ enddef
 
 def Shadowed(): list<number>
   var FuncList: list<func: number> = [() => 42]
-  return FuncList->map((_, Shadowed) => Shadowed())
+  return FuncList->mapnew((_, Shadowed) => Shadowed())
 enddef
 
 def Test_lambda_arg_shadows_func()
@@ -1792,7 +1792,7 @@ enddef
 
 def Line_continuation_in_lambda(): list<string>
   var x = range(97, 100)
-      ->map((_, v) => nr2char(v)
+      ->mapnew((_, v) => nr2char(v)
           ->toupper())
       ->reverse()
   return x
@@ -1908,7 +1908,7 @@ def Test_recursive_call()
 enddef
 
 def TreeWalk(dir: string): list<any>
-  return readdir(dir)->map((_, val) =>
+  return readdir(dir)->mapnew((_, val) =>
             fnamemodify(dir .. '/' .. val, ':p')->isdirectory()
                ? {[val]: TreeWalk(dir .. '/' .. val)}
                : val