summaryrefslogtreecommitdiffstats
path: root/src/dict.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-02-03 17:41:24 +0100
committerBram Moolenaar <Bram@vim.org>2021-02-03 17:41:24 +0100
commit2e5910bfbb05957c10c9c69756dfa342557e9a8b (patch)
treec70cb2b5240cb3f8465cb14773a11c25622e9a41 /src/dict.c
parent91478ae49a1b2dc1de63821db731a343e855dcc0 (diff)
patch 8.2.2455: Vim9: key type for literal dict and indexing is inconsistentv8.2.2455
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)
Diffstat (limited to 'src/dict.c')
-rw-r--r--src/dict.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/dict.c b/src/dict.c
index b267e240db..260f229850 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -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)
{