patch 8.2.2455: Vim9: key type for literal dict and indexing is inconsistent
Problem: Vim9: key type that can be used for literal dict and indexing is
inconsistent.
Solution: Allow using number and bool as key for a literal dict. (#7771)
This commit is contained in:
@ -548,6 +548,12 @@ In case the key needs to be an expression, square brackets can be used, just
|
||||
like in JavaScript: >
|
||||
var dict = {["key" .. nr]: value}
|
||||
|
||||
The key type can be string, number, bool or float. Other types result in an
|
||||
error. A number can be given with and without the []: >
|
||||
var dict = {123: 'without', [456]: 'with'}
|
||||
echo dict
|
||||
{'456': 'with', '123': 'without'}
|
||||
|
||||
|
||||
No :xit, :t, :append, :change or :insert ~
|
||||
|
||||
|
||||
Reference in New Issue
Block a user