To: vim_dev@googlegroups.com Subject: Patch 8.2.2139 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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', 3) + lines =<< trim END + var lines: list + 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> 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 -- Bram@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 ///