1
0
forked from aniani/vim

patch 8.2.4697: Vim9: crash when adding a duplicate key to a dictionary

Problem:    Vim9: crash when adding a duplicate key to a dictionary.
Solution:   Clear the stack item when it has been moved into the dictionary.
            (closes #10087)
This commit is contained in:
Bram Moolenaar
2022-04-05 17:30:29 +01:00
parent 478700336d
commit 0d1f55c044
3 changed files with 9 additions and 2 deletions

View File

@@ -2774,6 +2774,9 @@ def Test_expr8_dict()
v9.CheckScriptFailure(['vim9script', "var x = {xxx: 1,"], 'E723:', 2)
v9.CheckDefAndScriptFailure(["var x = {['a']: xxx}"], ['E1001:', 'E121:'], 1)
v9.CheckDefAndScriptFailure(["var x = {a: 1, a: 2}"], 'E721:', 1)
g:key = 'x'
v9.CheckDefExecAndScriptFailure(["var x = {[g:key]: 'text', [g:key]: 'text'}"], 'E721:', 1)
unlet g:key
v9.CheckDefExecAndScriptFailure(["var x = g:anint.member"], ['E715:', 'E488:'], 1)
v9.CheckDefExecAndScriptFailure(["var x = g:dict_empty.member"], 'E716:', 1)