0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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.
This commit is contained in:
Bram Moolenaar
2021-06-06 14:14:39 +02:00
parent 7a2217bedd
commit 3cfa5b16b0
12 changed files with 46 additions and 19 deletions

View File

@@ -607,7 +607,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
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 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
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)
{