diff src/testdir/test_vim9_builtin.vim @ 27567:5bf2fca4f967 v8.2.4310

patch 8.2.4310: Vim9: constant list and dict get a declaration type Commit: https://github.com/vim/vim/commit/2626d6a71ca616bd91d4ee2c27bd76a78a00d412 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 6 15:49:35 2022 +0000 patch 8.2.4310: Vim9: constant list and dict get a declaration type Problem: Vim9: constant list and dict get a declaration type other than "any". Solution: A constant list and dict have a declared member type "any". (closes #9701)
author Bram Moolenaar <Bram@vim.org>
date Sun, 06 Feb 2022 17:00:03 +0100
parents 829aec0d0387
children 68eac9355e49
line wrap: on
line diff
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -2237,6 +2237,11 @@ def Test_map()
       g:gl = l
       map(g:gl, (k, v) => true)
       assert_equal([true], g:gl)
+
+      assert_equal(['x'], [[1, 2]]->map((_, v) => 'x'))
+      assert_equal(['x'], [{a: 0}]->map((_, v) => 'x'))
+      assert_equal({a: 'x'}, {a: [1, 2]}->map((_, v) => 'x'))
+      assert_equal({a: 'x'}, {a: {b: 2}}->map((_, v) => 'x'))
   END
   v9.CheckDefAndScriptSuccess(lines)
 enddef