patch 8.2.2949: tests failing because no error for float to string conversion
Problem: Tests failing because there is no error for float to string
conversion.
Solution: Change the check for failure to check for correct result. Make
some conversions strict in Vim9 script.
diff --git a/src/json.c b/src/json.c
index db25b70..d0a087a 100644
--- a/src/json.c
+++ b/src/json.c
@@ -607,7 +607,7 @@
cur_item = res;
init_tv(&item);
if (res != NULL)
- init_tv(res);
+ init_tv(res);
fill_numbuflen(reader);
p = reader->js_buf + reader->js_used;
@@ -920,6 +920,15 @@
if (top_item != NULL && top_item->jd_type == JSON_OBJECT_KEY
&& cur_item != NULL)
{
+#ifdef FEAT_FLOAT
+ if (cur_item->v_type == VAR_FLOAT)
+ {
+ // cannot use a float as a key
+ emsg(_(e_float_as_string));
+ retval = FAIL;
+ goto theend;
+ }
+#endif
top_item->jd_key = tv_get_string_buf_chk(cur_item, key_buf);
if (top_item->jd_key == NULL)
{