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)
diff --git a/src/dict.c b/src/dict.c
index b267e24..260f229 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -953,11 +953,13 @@
}
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)
{