To: vim_dev@googlegroups.com Subject: Patch 8.2.0469 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0469 Problem: Vim9: no error for missing ] after list. Solution: Add error message. Add more tests. Files: src/globals.h, src/list.c, src/userfunc.c, src/testdir/test_vim9_expr.vim, src/testdir/test_lambda.vim *** ../vim-8.2.0468/src/globals.h 2020-03-27 20:52:41.350231375 +0100 --- src/globals.h 2020-03-28 21:14:17.420995578 +0100 *************** *** 1644,1649 **** --- 1644,1650 ---- EXTERN char e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: %s")); EXTERN char e_listreq[] INIT(= N_("E714: List required")); EXTERN char e_listblobreq[] INIT(= N_("E897: List or Blob required")); + EXTERN char e_list_end[] INIT(= N_("E697: Missing end of List ']': %s")); EXTERN char e_listdictarg[] INIT(= N_("E712: Argument of %s must be a List or Dictionary")); EXTERN char e_listdictblobarg[] INIT(= N_("E896: Argument of %s must be a List, Dictionary or Blob")); EXTERN char e_modulus[] INIT(= N_("E804: Cannot use '%' with Float")); *** ../vim-8.2.0468/src/list.c 2020-01-29 22:17:13.029497794 +0100 --- src/list.c 2020-03-28 21:14:08.841022803 +0100 *************** *** 1083,1089 **** if (**arg != ']') { if (do_error) ! semsg(_("E697: Missing end of List ']': %s"), *arg); failret: if (evaluate) list_free(l); --- 1083,1089 ---- if (**arg != ']') { if (do_error) ! semsg(_(e_list_end), *arg); failret: if (evaluate) list_free(l); *** ../vim-8.2.0468/src/userfunc.c 2020-03-18 15:23:10.983695087 +0100 --- src/userfunc.c 2020-03-28 21:25:19.006823879 +0100 *************** *** 350,356 **** --- 350,359 ---- e = *arg; *arg = skipwhite(*arg); if (**arg != '}') + { + semsg(_("E451: Expected }: %s"), *arg); goto errret; + } ++*arg; if (evaluate) *** ../vim-8.2.0468/src/testdir/test_vim9_expr.vim 2020-03-28 19:41:29.595765241 +0100 --- src/testdir/test_vim9_expr.vim 2020-03-28 21:30:17.569974632 +0100 *************** *** 806,811 **** --- 806,817 ---- call CheckDefFailure("let x = @", "E1002:") call CheckDefFailure("let x = @<", "E354:") + call CheckDefFailure("let x = [1, 2", "E697:") + call CheckDefFailure("let x = [notfound]", "E1001:") + + call CheckDefFailure("let x = { -> 123) }", "E451:") + call CheckDefFailure("let x = 123->{x -> x + 5) }", "E451:") + call CheckDefFailure("let x = ¬exist", 'E113:') call CheckDefExecFailure("&grepprg = [343]", 'E1051:') *************** *** 878,883 **** --- 884,890 ---- func Test_expr7_trailing_fails() call CheckDefFailureList(['let l = [2]', 'l->{l -> add(l, 8)}'], 'E107') + call CheckDefFailureList(['let l = [2]', 'l->{l -> add(l, 8)} ()'], 'E274') endfunc func Test_expr_fails() *** ../vim-8.2.0468/src/testdir/test_lambda.vim 2020-03-20 18:20:47.080975621 +0100 --- src/testdir/test_lambda.vim 2020-03-28 21:36:41.993024023 +0100 *************** *** 62,68 **** function Test_lambda_fails() call assert_equal(3, {a, b -> a + b}(1, 2)) call assert_fails('echo {a, a -> a + a}(1, 2)', 'E853:') ! call assert_fails('echo {a, b -> a + b)}(1, 2)', 'E15:') echo assert_fails('echo 10->{a -> a + 2}', 'E107:') endfunc --- 62,68 ---- function Test_lambda_fails() call assert_equal(3, {a, b -> a + b}(1, 2)) call assert_fails('echo {a, a -> a + a}(1, 2)', 'E853:') ! call assert_fails('echo {a, b -> a + b)}(1, 2)', 'E451:') echo assert_fails('echo 10->{a -> a + 2}', 'E107:') endfunc *** ../vim-8.2.0468/src/version.c 2020-03-28 20:44:37.554078887 +0100 --- src/version.c 2020-03-28 21:17:34.216362280 +0100 *************** *** 740,741 **** --- 740,743 ---- { /* Add new patch number below this line */ + /**/ + 469, /**/ -- Yesterday is history. Tomorrow is a mystery. Today is a gift. That's why it is called 'present'. /// 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 ///