0
0
mirror of https://github.com/vim/vim.git synced 2025-09-30 04:44:14 -04:00

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 #6390)
This commit is contained in:
Bram Moolenaar
2020-07-04 19:19:43 +02:00
parent eeb27bfe28
commit fb9d5c51c8
3 changed files with 10 additions and 1 deletions

View File

@@ -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')