Patch 8.2.2139

2 views
Skip to first unread message

Bram Moolenaar

unread,
Dec 13, 2020, 12:45:15 PM12/13/20
to vim...@googlegroups.com

Patch 8.2.2139
Problem: Vim9: unreachable code in assignment.
Solution: Don't check "new_local" when "has_index" is set. Add test for
wrong type of list index.
Files: src/vim9compile.c, src/testdir/test_vim9_assign.vim


*** ../vim-8.2.2138/src/vim9compile.c 2020-12-13 14:19:22.131979168 +0100
--- src/vim9compile.c 2020-12-13 18:35:24.690745812 +0100
***************
*** 5856,5863 ****
int r;

// Compile the "idx" in "var[idx]" or "key" in "var.key".
- if (new_local)
- --cctx->ctx_locals.ga_len;
p = var_start + varlen;
if (*p == '[')
{
--- 5856,5861 ----
***************
*** 5877,5884 ****

r = generate_PUSHS(cctx, key);
}
- if (new_local)
- ++cctx->ctx_locals.ga_len;
if (r == FAIL)
goto theend;

--- 5875,5880 ----
*** ../vim-8.2.2138/src/testdir/test_vim9_assign.vim 2020-12-13 17:50:16.734956500 +0100
--- src/testdir/test_vim9_assign.vim 2020-12-13 18:43:18.246435950 +0100
***************
*** 326,331 ****
--- 326,343 ----
END
CheckDefFailure(lines, 'E1012: Type mismatch; expected number but got dict<unknown>', 3)

+ lines =<< trim END
+ var lines: list<string>
+ lines['a'] = 'asdf'
+ END
+ CheckDefFailure(lines, 'E39:', 2)
+
+ lines =<< trim END
+ var lines: string
+ lines[9] = 'asdf'
+ END
+ CheckDefFailure(lines, 'E1141:', 2)
+
# list of dict
var ld: list<dict<number>>
ld[0] = {}
*** ../vim-8.2.2138/src/version.c 2020-12-13 17:50:16.734956500 +0100
--- src/version.c 2020-12-13 18:44:07.106073446 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2139,
/**/

--
Wi n0t trei a h0liday in Sweden thi yer?
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages