Mercurial > vim
comparison src/testdir/test_listdict.vim @ 26342:936f77929f16 v8.2.3702
patch 8.2.3702: first key in dict is seen as curly expression and fails
Commit: https://github.com/vim/vim/commit/98cb90ef865089a5ddd20bc0303d449fb7d97fb2
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Nov 30 11:56:22 2021 +0000
patch 8.2.3702: first key in dict is seen as curly expression and fails
Problem: First key in dict is seen as curly expression and fails.
Solution: Ignore failure of curly expression. (closes https://github.com/vim/vim/issues/9247)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 30 Nov 2021 13:00:06 +0100 |
parents | 8afd7aa25ab6 |
children | bdf11d8e3df3 |
comparison
equal
deleted
inserted
replaced
26341:b9b685b5f8ae | 26342:936f77929f16 |
---|---|
295 call assert_fails('let d = #{++ : 10}', 'E15:') | 295 call assert_fails('let d = #{++ : 10}', 'E15:') |
296 " wrong type for key | 296 " wrong type for key |
297 call assert_fails('let d={[] : 10}', 'E730:') | 297 call assert_fails('let d={[] : 10}', 'E730:') |
298 " undefined variable as value | 298 " undefined variable as value |
299 call assert_fails("let d={'k' : i}", 'E121:') | 299 call assert_fails("let d={'k' : i}", 'E121:') |
300 | |
301 " allow key starting with number at the start, not a curly expression | |
302 call assert_equal({'1foo': 77}, #{1foo: 77}) | |
300 endfunc | 303 endfunc |
301 | 304 |
302 " This was allowed in legacy Vim script | 305 " This was allowed in legacy Vim script |
303 let s:dict_with_spaces = {'one' : 1 , 'two' : 2 , 'three' : 3} | 306 let s:dict_with_spaces = {'one' : 1 , 'two' : 2 , 'three' : 3} |
304 let s:dict_with_spaces_lit = #{one : 1 , two : 2 , three : 3} | 307 let s:dict_with_spaces_lit = #{one : 1 , two : 2 , three : 3} |