diff src/testdir/test_vim9_expr.vim @ 21152:1561311249bb v8.2.1127

patch 8.2.1127: Vim9: getting a dict member may not work Commit: https://github.com/vim/vim/commit/fb9d5c51c8b5b44863f974e1adbee9ae330e75ff Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 4 19:19:43 2020 +0200 patch 8.2.1127: Vim9: getting a dict member may not work Problem: Vim9: getting a dict member may not work. Solution: Clear the dict only after copying the item. (closes https://github.com/vim/vim/issues/6390)
author Bram Moolenaar <Bram@vim.org>
date Sat, 04 Jul 2020 19:30:04 +0200
parents 165cea61e974
children 64f664f9b23a
line wrap: on
line diff
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -1133,6 +1133,9 @@ def Test_expr_member()
   let d: dict<number> = g:dict_one
   assert_equal(1, d['one'])
 
+  # getting the one member should clear the dict after getting the item
+  assert_equal('one', #{one: 'one'}.one)
+
   call CheckDefFailure(["let x = g:dict_one.#$!"], 'E1002:')
   call CheckDefExecFailure(["let d: dict<any>", "echo d['a']"], 'E716:')
   call CheckDefExecFailure(["let d: dict<number>", "d = g:list_empty"], 'E1029: Expected dict but got list')