0
0
mirror of https://github.com/vim/vim.git synced 2025-10-28 09:27:14 -04:00

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:
Bram Moolenaar
2021-02-03 17:41:24 +01:00
parent 91478ae49a
commit 2e5910bfbb
8 changed files with 74 additions and 38 deletions

View File

@@ -953,11 +953,13 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
}
if (evaluate)
{
if (vim9script && check_for_string(&tvkey) == FAIL)
#ifdef FEAT_FLOAT
if (tvkey.v_type == VAR_FLOAT)
{
clear_tv(&tvkey);
goto failret;
tvkey.vval.v_string = typval_tostring(&tvkey, TRUE);
tvkey.v_type = VAR_STRING;
}
#endif
key = tv_get_string_buf_chk(&tvkey, buf);
if (key == NULL)
{