0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 8.2.2090: Vim9: dict does not accept a key in quotes

Problem:    Vim9: dict does not accept a key in quotes.
Solution:   Recognize a key in single or double quotes.
This commit is contained in:
Bram Moolenaar
2020-12-04 19:12:14 +01:00
parent 6cd42db9dc
commit c5e6a7179d
6 changed files with 83 additions and 29 deletions

View File

@@ -1930,12 +1930,13 @@ def Test_expr7_dict()
assert_equal(g:test_space_dict, {['']: 'empty', [' ']: 'space'})
assert_equal(g:test_hash_dict, {one: 1, two: 2})
assert_equal({['a a']: 1, ['b/c']: 2}, {'a a': 1, "b/c": 2})
END
CheckDefAndScriptSuccess(lines)
# legacy syntax doesn't work
CheckDefFailure(["var x = #{key: 8}"], 'E1097:', 2)
CheckDefFailure(["var x = {'key': 8}"], 'E1014:', 1)
CheckDefFailure(["var x = 'a' .. #{a: 1}"], 'E1097:', 2)
CheckDefFailure(["var x = {a:8}"], 'E1069:', 1)