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 -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202012131745.0BDHj7rA3131833%40masaka.moolenaar.net.