Patch 8.2.2173
Patch 8.2.2173 Problem:Vim9: get internal error when assigning to undefined variable. Solution: Add error message. (closes #7475) Files: src/vim9compile.c, src/vim9execute.c, src/errors.h, src/testdir/test_vim9_cmd.vim *** ../vim-8.2.2172/src/vim9compile.c 2020-12-20 15:20:53.326899494 +0100 --- src/vim9compile.c 2020-12-20 21:36:03.626874518 +0100 *** *** 7681,7688 // Expression or function call. if (ea.cmdidx != CMD_eval) { ! // CMD_var cannot happen, compile_assignment() above is used ! iemsg("Command from find_ex_command() not handled"); goto erret; } } --- 7681,7689 // Expression or function call. if (ea.cmdidx != CMD_eval) { ! // CMD_var cannot happen, compile_assignment() above would be ! // used. Most likely an assignment to a non-existing variable. ! semsg(_(e_command_not_recognized_str), ea.cmd); goto erret; } } *** ../vim-8.2.2172/src/vim9execute.c 2020-12-20 21:10:13.902437880 +0100 --- src/vim9execute.c 2020-12-20 21:41:31.477415038 +0100 *** *** 606,613 return FAIL; if (ufunc->uf_def_status == UF_COMPILED) { ! int error = check_user_func_argcount(ufunc, argcount); ! if (error != FCERR_UNKNOWN) { if (error == FCERR_TOOMANY) --- 606,612 return FAIL; if (ufunc->uf_def_status == UF_COMPILED) { ! error = check_user_func_argcount(ufunc, argcount); if (error != FCERR_UNKNOWN) { if (error == FCERR_TOOMANY) *** ../vim-8.2.2172/src/errors.h2020-12-13 17:50:16.734956500 +0100 --- src/errors.h2020-12-20 21:37:43.066430610 +0100 *** *** 321,323 --- 321,325 INIT(= N_("E1144: Command is not followed by white space: %s")); EXTERN char e_missing_heredoc_end_marker_str[] INIT(= N_("E1145: Missing heredoc end marker: %s")); + EXTERN char e_command_not_recognized_str[] + INIT(= N_("E1146: Command not recognized: %s")); *** ../vim-8.2.2172/src/testdir/test_vim9_cmd.vim 2020-12-16 21:43:47.451181035 +0100 --- src/testdir/test_vim9_cmd.vim 2020-12-20 21:42:36.245127863 +0100 *** *** 710,714 --- 710,725 CheckScriptFailure(lines, 'E464:') enddef + def Test_command_not_recognized() + var lines =<< trim END + d.key = 'asdf' + END + CheckDefFailure(lines, 'E1146:', 1) + + lines =<< trim END + d['key'] = 'asdf' + END + CheckDefFailure(lines, 'E1146:', 1) + enddef " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker *** ../vim-8.2.2172/src/version.c 2020-12-20 21:10:13.902437880 +0100 --- src/version.c 2020-12-20 21:37:17.014546784 +0100 *** *** 752,753 --- 752,755 { /* Add new patch number below this line */ + /**/ + 2173, /**/ -- If the Universe is constantly expanding, why can't I ever find a parking space? /// Bram Moolenaar -- b...@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/// -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202012202044.0BKKi85N2018976%40masaka.moolenaar.net.
Re: vim9: internal error when calling a function reference with less number of arguments
Yegappan wrote: > I am getting a "E685: Internal error: copy_tv(UNKNOWN)" error when > using the following vim9 script: > > = > vim9script > > def Func1(arg1: string, arg2: dict, arg3: dict) > var v = arg3.value > enddef > > def g:Test() > var funcMap: dict = {'msg': Func1} > funcMap['msg']('abc', {'value': 10}) > enddef > > call Test() > = Fixed by patch 8.2.2172. -- A salesperson says:Translation: "backward compatible" Old technology "Premium" Overpriced "Can't keep it on the shelf" Unavailable "Stands alone" Piece of shit "Proprietary" Incompatible (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- b...@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/// -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202012202011.0BKKBENQ2007399%40masaka.moolenaar.net.
Patch 8.2.2172
Patch 8.2.2172 Problem:Vim9: number of arguments is not always checked. (Yegappan Lakshmanan) Solution: Check number of arguments when calling function by name. Files: src/userfunc.c, src/proto/userfunc.pro, src/vim9execute.c, src/testdir/test_vim9_func.vim, src/testdir/test_vim9_script.vim *** ../vim-8.2.2171/src/userfunc.c 2020-12-20 17:47:49.253182274 +0100 --- src/userfunc.c 2020-12-20 20:56:12.843590663 +0100 *** *** 1834,1839 --- 1834,1855 } /* + * Check the argument count for user function "fp". + * Return FCERR_UNKNOWN if OK, FCERR_TOOFEW or FCERR_TOOMANY otherwise. + */ + int + check_user_func_argcount(ufunc_T *fp, int argcount) + { + int regular_args = fp->uf_args.ga_len; + + if (argcount < regular_args - fp->uf_def_args.ga_len) + return FCERR_TOOFEW; + else if (!has_varargs(fp) && argcount > regular_args) + return FCERR_TOOMANY; + return FCERR_UNKNOWN; + } + + /* * Call a user function after checking the arguments. */ int *** *** 1846,1860 dict_T *selfdict) { int error; - int regular_args = fp->uf_args.ga_len; if (fp->uf_flags & FC_RANGE && funcexe->doesrange != NULL) *funcexe->doesrange = TRUE; ! if (argcount < regular_args - fp->uf_def_args.ga_len) ! error = FCERR_TOOFEW; ! else if (!has_varargs(fp) && argcount > regular_args) ! error = FCERR_TOOMANY; ! else if ((fp->uf_flags & FC_DICT) && selfdict == NULL) error = FCERR_DICT; else { --- 1862,1874 dict_T *selfdict) { int error; if (fp->uf_flags & FC_RANGE && funcexe->doesrange != NULL) *funcexe->doesrange = TRUE; ! error = check_user_func_argcount(fp, argcount); ! if (error != FCERR_UNKNOWN) ! return error; ! if ((fp->uf_flags & FC_DICT) && selfdict == NULL) error = FCERR_DICT; else { *** ../vim-8.2.2171/src/proto/userfunc.pro 2020-12-20 17:47:49.253182274 +0100 --- src/proto/userfunc.pro 2020-12-20 20:55:48.827682599 +0100 *** *** 18,23 --- 18,24 void funcdepth_decrement(void); int funcdepth_get(void); void funcdepth_restore(int depth); + int check_user_func_argcount(ufunc_T *fp, int argcount); int call_user_func_check(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rettv, funcexe_T *funcexe, dict_T *selfdict); void save_funccal(funccal_entry_T *entry); void restore_funccal(void); *** ../vim-8.2.2171/src/vim9execute.c 2020-12-20 17:47:49.253182274 +0100 --- src/vim9execute.c 2020-12-20 20:55:42.915705255 +0100 *** *** 606,611 --- 606,622 return FAIL; if (ufunc->uf_def_status == UF_COMPILED) { + int error = check_user_func_argcount(ufunc, argcount); + + if (error != FCERR_UNKNOWN) + { + if (error == FCERR_TOOMANY) + semsg(_(e_toomanyarg), ufunc->uf_name); + else + semsg(_(e_toofewarg), ufunc->uf_name); + return FAIL; + } + // The function has been compiled, can call it quickly. For a function // that was defined later: we can call it directly next time. if (iptr != NULL) *** ../vim-8.2.2171/src/testdir/test_vim9_func.vim 2020-12-20 17:47:49.257182258 +0100 --- src/testdir/test_vim9_func.vim 2020-12-20 21:04:35.512663131 +0100 *** *** 470,475 --- 470,494 delete('Xscript') enddef + def Test_call_funcref_wrong_args() + var head =<< trim END + vim9script + def Func3(a1: string, a2: number, a3: list) + echo a1 .. a2 .. a3[0] + enddef + def Testme() + var funcMap: dict = {func: Func3} + END + var tail =<< trim END + enddef + Testme() + END + CheckScriptSuccess(head + ["funcMap['func']('str', 123, [1, 2, 3])"] + tail) + + CheckScriptFailure(head + ["funcMap['func']('str', 123)"] + tail, 'E119:') + CheckScriptFailure(head + ["funcMap['func']('str', 123, [1], 4)"] + tail, 'E118:') + enddef + def Test_call_lambda_args() CheckDefFailure(['echo {i -> 0}()'], 'E119: Not enough arguments for function: {i -> 0}()') *** ../vim-8.2.2171/src/testdir/test_vim9_script.vim2020-12-20 15:43:27.667305001 +0100 --- src/testdir/test_vim9_script.vim2020-12-20 21:06:49.307724159 +0100 *** *** 1312,1323 # FuncNo() is not redefined writefile(first_lines + nono_lines, 'Xreloaded.vim') source Xreloaded.vim ! g:DoCheck() # FuncNo() is back writefile(first_lines + withno_lines, 'Xreloaded.vim') source Xreloaded.vim ! g:DoCheck() delete('Xreloaded.vim') enddef --- 1312,1323 # FuncNo() is not redefined writefile(first_lines + nono_lines, 'Xreloaded.vim') source Xreloaded.vim ! g:DoCheck(false) # FuncNo() is back writefile(first_lines +
vim9: internal error when calling a function reference with less number of arguments
Hi, I am getting a "E685: Internal error: copy_tv(UNKNOWN)" error when using the following vim9 script: = vim9script def Func1(arg1: string, arg2: dict, arg3: dict) var v = arg3.value enddef def g:Test() var funcMap: dict = {'msg': Func1} funcMap['msg']('abc', {'value': 10}) enddef call Test() = - Yegappan -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAAW7x7k3L0fUB%2Be9xN8YrZejcoQXU9BLJLL5JbgVfFfZuif1vw%40mail.gmail.com.
Patch 8.2.2171
Patch 8.2.2171 Problem:Valgrind warning for using uninitialized value. Solution: Do not use "startp" or "endp" unless there is a match. Files: src/regexp_nfa.c *** ../vim-8.2.2170/src/regexp_nfa.c2020-12-09 16:36:00.404656177 +0100 --- src/regexp_nfa.c2020-12-20 17:39:40.939320694 +0100 *** *** 7236,7242 || (end->lnum == start->lnum && end->col < start->col)) rex.reg_mmatch->endpos[0] = rex.reg_mmatch->startpos[0]; } ! else { if (rex.reg_match->endp[0] < rex.reg_match->startp[0]) rex.reg_match->endp[0] = rex.reg_match->startp[0]; --- 7236,7242 || (end->lnum == start->lnum && end->col < start->col)) rex.reg_mmatch->endpos[0] = rex.reg_mmatch->startpos[0]; } ! else if (retval > 0) { if (rex.reg_match->endp[0] < rex.reg_match->startp[0]) rex.reg_match->endp[0] = rex.reg_match->startp[0]; *** ../vim-8.2.2170/src/version.c 2020-12-20 17:47:49.257182258 +0100 --- src/version.c 2020-12-20 17:59:32.634380583 +0100 *** *** 752,753 --- 752,755 { /* Add new patch number below this line */ + /**/ + 2171, /**/ -- You can test a person's importance in the organization by asking how much RAM his computer has. Anybody who knows the answer to that question is not a decision-maker. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- b...@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/// -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202012201700.0BKH0gmj1952778%40masaka.moolenaar.net.
Patch 8.2.2170
Patch 8.2.2170 Problem:Vim9: a global function defined in a :def function fails if it uses the context. Solution: Create a partial to store the closure context. (see #7410) Files: src/userfunc.c, src/proto/userfunc.pro, src/vim9execute.c, src/structs.h, src/testdir/test_vim9_func.vim *** ../vim-8.2.2169/src/userfunc.c 2020-12-19 21:23:38.797667072 +0100 --- src/userfunc.c 2020-12-20 17:22:24.359338305 +0100 *** *** 1225,1230 --- 1225,1232 VIM_CLEAR(fp->uf_block_ids); VIM_CLEAR(fp->uf_va_name); clear_type_list(>uf_type_list); + partial_unref(fp->uf_partial); + fp->uf_partial = NULL; #ifdef FEAT_LUA if (fp->uf_cb_free != NULL) *** *** 1305,1316 /* * Copy already defined function "lambda" to a new function with name "global". * This is for when a compiled function defines a global function. */ ! void copy_func(char_u *lambda, char_u *global) { ufunc_T *ufunc = find_func_even_dead(lambda, TRUE, NULL); ! ufunc_T *fp; if (ufunc == NULL) semsg(_(e_lambda_function_not_found_str), lambda); --- 1307,1319 /* * Copy already defined function "lambda" to a new function with name "global". * This is for when a compiled function defines a global function. + * Caller should take care of adding a partial for a closure. */ ! ufunc_T * copy_func(char_u *lambda, char_u *global) { ufunc_T *ufunc = find_func_even_dead(lambda, TRUE, NULL); ! ufunc_T *fp = NULL; if (ufunc == NULL) semsg(_(e_lambda_function_not_found_str), lambda); *** *** 1321,1332 if (fp != NULL) { semsg(_(e_funcexts), global); ! return; } fp = alloc_clear(offsetof(ufunc_T, uf_name) + STRLEN(global) + 1); if (fp == NULL) ! return; fp->uf_varargs = ufunc->uf_varargs; fp->uf_flags = (ufunc->uf_flags & ~FC_VIM9) | FC_COPY; --- 1324,1335 if (fp != NULL) { semsg(_(e_funcexts), global); ! return NULL; } fp = alloc_clear(offsetof(ufunc_T, uf_name) + STRLEN(global) + 1); if (fp == NULL) ! return NULL; fp->uf_varargs = ufunc->uf_varargs; fp->uf_flags = (ufunc->uf_flags & ~FC_VIM9) | FC_COPY; *** *** 1362,1376 if (fp->uf_va_name == NULL) goto failed; } fp->uf_refcount = 1; STRCPY(fp->uf_name, global); hash_add(_hashtab, UF2HIKEY(fp)); } ! return; failed: func_clear_free(fp, TRUE); } static intfuncdepth = 0; --- 1365,1381 if (fp->uf_va_name == NULL) goto failed; } + fp->uf_ret_type = ufunc->uf_ret_type; fp->uf_refcount = 1; STRCPY(fp->uf_name, global); hash_add(_hashtab, UF2HIKEY(fp)); } ! return fp; failed: func_clear_free(fp, TRUE); + return NULL; } static intfuncdepth = 0; *** ../vim-8.2.2169/src/proto/userfunc.pro 2020-11-22 18:15:40.171258382 +0100 --- src/proto/userfunc.pro 2020-12-20 16:53:12.854005764 +0100 *** *** 13,19 ufunc_T *find_func(char_u *name, int is_global, cctx_T *cctx); int func_is_global(ufunc_T *ufunc); int func_name_refcount(char_u *name); ! void copy_func(char_u *lambda, char_u *global); int funcdepth_increment(void); void funcdepth_decrement(void); int funcdepth_get(void); --- 13,19 ufunc_T *find_func(char_u *name, int is_global, cctx_T *cctx); int func_is_global(ufunc_T *ufunc); int func_name_refcount(char_u *name); ! ufunc_T *copy_func(char_u *lambda, char_u *global); int funcdepth_increment(void); void funcdepth_decrement(void); int funcdepth_get(void); *** ../vim-8.2.2169/src/vim9execute.c 2020-12-19 16:30:39.439810130 +0100 --- src/vim9execute.c 2020-12-20 17:34:40.152702327 +0100 *** *** 845,850 --- 845,893 } /* + * When a function reference is used, fill a partial with the information + * needed, especially when it is used as a closure. + */ + static int + fill_partial_and_closure(partial_T *pt, ufunc_T *ufunc, ectx_T *ectx) + { + pt->pt_func = ufunc; + pt->pt_refcount = 1; + + if (pt->pt_func->uf_flags & FC_CLOSURE) + { + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + ectx->ec_dfunc_idx; + + // The closure needs to find arguments and local + // variables in the current stack. + pt->pt_ectx_stack = >ec_stack; + pt->pt_ectx_frame = ectx->ec_frame_idx; + + // If this function returns and the closure is still + // being used, we need to make a copy of the context + // (arguments and local variables). Store a reference + // to the partial so we can handle that. +
Patch 8.2.2169
Patch 8.2.2169 Problem:Vim9: test leaves file behind. Solution: Rename script files. (Dominique Pellé, closes #7511) Use try/finally. Files: src/testdir/test_vim9_script.vim, src/testdir/vim9.vim *** ../vim-8.2.2168/src/testdir/test_vim9_script.vim2020-12-19 21:23:38.797667072 +0100 --- src/testdir/test_vim9_script.vim2020-12-20 15:34:55.301013355 +0100 *** *** 2412,2418 'delcommand Echo', ]) CheckScriptSuccess([ ! 'vim9script' 'command Echo cd # comment', 'Echo', 'delcommand Echo', --- 2412,2418 'delcommand Echo', ]) CheckScriptSuccess([ ! 'vim9script', 'command Echo cd # comment', 'Echo', 'delcommand Echo', *** *** 2949,2954 --- 2949,2955 endif delete('Xsourced') delete('Xclose') + delete('Xdone') enddef *** ../vim-8.2.2168/src/testdir/vim9.vim2020-12-05 13:40:57.495035088 +0100 --- src/testdir/vim9.vim2020-12-20 15:41:23.523734126 +0100 *** *** 5,17 " Check that "lines" inside a ":def" function has no error. func CheckDefSuccess(lines) ! let fname = 'Xdef' .. s:sequence let s:sequence += 1 call writefile(['def Func()'] + a:lines + ['enddef', 'defcompile'], fname) ! exe 'so ' .. fname ! call Func() ! delfunc! Func ! call delete(fname) endfunc " Check that "lines" inside ":def" results in an "error" message. --- 5,22 " Check that "lines" inside a ":def" function has no error. func CheckDefSuccess(lines) ! let cwd = getcwd() ! let fname = 'XdefSuccess' .. s:sequence let s:sequence += 1 call writefile(['def Func()'] + a:lines + ['enddef', 'defcompile'], fname) ! try ! exe 'so ' .. fname ! call Func() ! delfunc! Func ! finally ! call chdir(cwd) ! call delete(fname) ! endtry endfunc " Check that "lines" inside ":def" results in an "error" message. *** *** 19,30 " Add a line before and after to make it less likely that the line number is " accidentally correct. func CheckDefFailure(lines, error, lnum = -3) ! let fname = 'Xdef' .. s:sequence ! call writefile(['def Func()', '# comment'] + a:lines + ['#comment', 'enddef', 'defcompile'], fname) ! call assert_fails('so ' .. fname, a:error, a:lines, a:lnum + 1) ! delfunc! Func ! call delete(fname) let s:sequence += 1 endfunc " Check that "lines" inside ":def" results in an "error" message when executed. --- 24,40 " Add a line before and after to make it less likely that the line number is " accidentally correct. func CheckDefFailure(lines, error, lnum = -3) ! let cwd = getcwd() ! let fname = 'XdefFailure' .. s:sequence let s:sequence += 1 + call writefile(['def Func()', '# comment'] + a:lines + ['#comment', 'enddef', 'defcompile'], fname) + try + call assert_fails('so ' .. fname, a:error, a:lines, a:lnum + 1) + finally + call chdir(cwd) + call delete(fname) + delfunc! Func + endtry endfunc " Check that "lines" inside ":def" results in an "error" message when executed. *** *** 32,60 " Add a line before and after to make it less likely that the line number is " accidentally correct. func CheckDefExecFailure(lines, error, lnum = -3) ! let fname = 'Xdef' .. s:sequence let s:sequence += 1 call writefile(['def Func()', '# comment'] + a:lines + ['#comment', 'enddef'], fname) ! exe 'so ' .. fname ! call assert_fails('call Func()', a:error, a:lines, a:lnum + 1) ! delfunc! Func ! call delete(fname) endfunc def CheckScriptFailure(lines: list, error: string, lnum = -3) ! var fname = 'Xdef' .. s:sequence s:sequence += 1 writefile(lines, fname) ! assert_fails('so ' .. fname, error, lines, lnum) ! delete(fname) enddef def CheckScriptSuccess(lines: list) ! var fname = 'Xdef' .. s:sequence s:sequence += 1 writefile(lines, fname) ! exe 'so ' .. fname ! delete(fname) enddef def CheckDefAndScriptSuccess(lines: list) --- 42,85 " Add a line before and after to make it less likely that the line number is " accidentally correct. func CheckDefExecFailure(lines, error, lnum = -3) ! let cwd = getcwd() ! let fname = 'XdefExecFailure' .. s:sequence let s:sequence += 1 call writefile(['def Func()', '# comment'] + a:lines + ['#comment', 'enddef'], fname) ! try ! exe 'so ' .. fname ! call assert_fails('call Func()', a:error, a:lines, a:lnum + 1) ! finally ! call chdir(cwd) ! call delete(fname) ! delfunc! Func ! endtry endfunc def CheckScriptFailure(lines: list, error: string, lnum = -3) ! var cwd = getcwd() ! var fname = 'XScriptFailure' .. s:sequence s:sequence += 1 writefile(lines, fname) ! try ! assert_fails('so ' .. fname, error, lines, lnum) ! finally ! chdir(cwd) ! delete(fname) ! endtry enddef
Re: Test failure in test_vim9_assign.vim
* Bram Moolenaar [2020-12-20 14:50 +0100]: > > Elimar Riesebieter wrote: > > > building 8.2.2166 gives me the following error: > > > > Failures: > > From test_vim9_assign.vim: > > Found errors in Test_assignment_dict(): > > command line..script > > /source/vim/vim-8.2.2166/src/vim-gtk3/testdir/runtest.vim[468]..function > > RunTheTest[39]..Test_assignment_dict[17]..CheckDefFailure line 3: ['var dd > > = {one: 1}', 'dd.one) = 2']: Expected 'E15:' but got 'E488: Trailing > > characters: ) = 2': ['var dd = {one: 1}', 'dd.one) = 2'] > > I'm sure I had fixed that... Ah, but didn't include the fix. Will make > a separate patch. Fixed with 8.2.2167. Thanks Elimar -- On the keyboard of life you have always to keep a finger at the escape key;-) -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20201220143010.2slyn2tcfjx3dynu%40toy.home.lxtec.de.
Patch 8.2.2168
Patch 8.2.2168 Problem:Vim9: error for assigning to dict of dict. Solution: Remember the destination type. (closes #7506) Files: src/vim9compile.c, src/testdir/test_vim9_assign.vim *** ../vim-8.2.2167/src/vim9compile.c 2020-12-19 16:30:39.439810130 +0100 --- src/vim9compile.c 2020-12-20 15:15:44.731796102 +0100 *** *** 5876,5882 if (has_index) { ! int r; // Compile the "idx" in "var[idx]" or "key" in "var.key". p = var_start + varlen; --- 5876,5883 if (has_index) { ! int r; ! vartype_T dest_type; // Compile the "idx" in "var[idx]" or "key" in "var.key". p = var_start + varlen; *** *** 5913,5922 else type = _dict_any; } ! if (type->tt_type == VAR_DICT && may_generate_2STRING(-1, cctx) == FAIL) goto theend; ! if (type->tt_type == VAR_LIST && ((type_T **)stack->ga_data)[stack->ga_len - 1]->tt_type != VAR_NUMBER) { --- 5914,5924 else type = _dict_any; } ! dest_type = type->tt_type; ! if (dest_type == VAR_DICT && may_generate_2STRING(-1, cctx) == FAIL) goto theend; ! if (dest_type == VAR_LIST && ((type_T **)stack->ga_data)[stack->ga_len - 1]->tt_type != VAR_NUMBER) { *** *** 5954,5965 else generate_loadvar(cctx, dest, name, lvar, type); ! if (type->tt_type == VAR_LIST) { if (generate_instr_drop(cctx, ISN_STORELIST, 3) == FAIL) goto theend; } ! else if (type->tt_type == VAR_DICT) { if (generate_instr_drop(cctx, ISN_STOREDICT, 3) == FAIL) goto theend; --- 5956,5967 else generate_loadvar(cctx, dest, name, lvar, type); ! if (dest_type == VAR_LIST) { if (generate_instr_drop(cctx, ISN_STORELIST, 3) == FAIL) goto theend; } ! else if (dest_type == VAR_DICT) { if (generate_instr_drop(cctx, ISN_STOREDICT, 3) == FAIL) goto theend; *** ../vim-8.2.2167/src/testdir/test_vim9_assign.vim2020-12-20 14:49:38.763472067 +0100 --- src/testdir/test_vim9_assign.vim2020-12-20 15:19:59.834929750 +0100 *** *** 560,565 --- 560,571 dict3.key = 'yet another' assert_equal(dict3, {key: 'yet another'}) + # member "any" can also be a dict and assigned to + var anydict: dict = {nest: {}, nr: 0} + anydict.nest['this'] = 123 + anydict.nest.that = 456 + assert_equal({nest: {this: 123, that: 456}, nr: 0}, anydict) + var lines =<< trim END vim9script var dd = {} *** ../vim-8.2.2167/src/version.c 2020-12-20 14:49:38.763472067 +0100 --- src/version.c 2020-12-20 15:16:41.327555058 +0100 *** *** 752,753 --- 752,755 { /* Add new patch number below this line */ + /**/ + 2168, /**/ -- Our job was to build a computer information system for the branch banks. We were the perfect people for the job: Dean had seen a computer once, and I had heard Dean talk about it. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- b...@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/// -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202012201421.0BKELKSN1902588%40masaka.moolenaar.net.
Re: Test failure in test_vim9_assign.vim
Elimar Riesebieter wrote: > building 8.2.2166 gives me the following error: > > Failures: > From test_vim9_assign.vim: > Found errors in Test_assignment_dict(): > command line..script > /source/vim/vim-8.2.2166/src/vim-gtk3/testdir/runtest.vim[468]..function > RunTheTest[39]..Test_assignment_dict[17]..CheckDefFailure line 3: ['var dd = > {one: 1}', 'dd.one) = 2']: Expected 'E15:' but got 'E488: Trailing > characters: ) = 2': ['var dd = {one: 1}', 'dd.one) = 2'] I'm sure I had fixed that... Ah, but didn't include the fix. Will make a separate patch. -- An easy way to determine if you have enough teamwork to be doomed is simply to measure how long it takes from the time you decide to go to lunch together until the time you actually eat. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- b...@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/// -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202012201350.0BKDo50c1894227%40masaka.moolenaar.net.
Patch 8.2.2167
Patch 8.2.2167 Problem:Vim9: assign test fails. (Elimar Riesebieter) Solution: Adjust the test for dict assignment. Files: src/testdir/test_vim9_assign.vim *** ../vim-8.2.2166/src/testdir/test_vim9_assign.vim2020-12-18 17:23:11.014359533 +0100 --- src/testdir/test_vim9_assign.vim2020-12-19 21:57:06.160140545 +0100 *** *** 561,570 assert_equal(dict3, {key: 'yet another'}) var lines =<< trim END var dd = {one: 1} dd.one) = 2 END ! CheckDefFailure(lines, 'E15:', 2) # empty key can be used var dd = {} --- 561,584 assert_equal(dict3, {key: 'yet another'}) var lines =<< trim END + vim9script + var dd = {} + dd.two = 2 + assert_equal({two: 2}, dd) + END + CheckScriptSuccess(lines) + + lines =<< trim END var dd = {one: 1} dd.one) = 2 END ! CheckDefFailure(lines, 'E488:', 2) ! ! lines =<< trim END ! var dd = {one: 1} ! var dd.one = 2 ! END ! CheckDefAndScriptFailure(lines, 'E1017:', 2) # empty key can be used var dd = {} *** ../vim-8.2.2166/src/version.c 2020-12-20 13:07:44.817149460 +0100 --- src/version.c 2020-12-20 14:49:26.019556031 +0100 *** *** 752,753 --- 752,755 { /* Add new patch number below this line */ + /**/ + 2167, /**/ -- "You're fired." (1980) "You're laid off." (1985) "You're downsized." (1990) "You're rightsized." (1992) (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- b...@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/// -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202012201350.0BKDo5Cl1894233%40masaka.moolenaar.net.
Test failure in test_vim9_assign.vim
Hi all, building 8.2.2166 gives me the following error: Failures: From test_vim9_assign.vim: Found errors in Test_assignment_dict(): command line..script /source/vim/vim-8.2.2166/src/vim-gtk3/testdir/runtest.vim[468]..function RunTheTest[39]..Test_assignment_dict[17]..CheckDefFailure line 3: ['var dd = {one: 1}', 'dd.one) = 2']: Expected 'E15:' but got 'E488: Trailing characters: ) = 2': ['var dd = {one: 1}', 'dd.one) = 2'] Thanks in advance Elimar -- Obviously the human brain works like a computer. Since there are no stupid computers humans can't be stupid. There are just a few running with Windows or even CE ;-) -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20201220132547.uizwuhsmaegkihe5%40toy.home.lxtec.de.
Patch 8.2.2166
Patch 8.2.2166 Problem:Auto format doesn't work when deleting text. Solution: Make "x" trigger auto format. (closes #7504) Files: src/ops.c, src/testdir/test_textformat.vim *** ../vim-8.2.2165/src/ops.c 2020-11-21 14:16:18.536766447 +0100 --- src/ops.c 2020-12-20 13:01:54.754992944 +0100 *** *** 938,943 --- 938,944 curwin->w_cursor = curpos; // restore curwin->w_cursor (void)do_join(2, FALSE, FALSE, FALSE, FALSE); } + auto_format(FALSE, TRUE); } msgmore(curbuf->b_ml.ml_line_count - old_lcount); *** ../vim-8.2.2165/src/testdir/test_textformat.vim 2020-06-24 13:37:03.162425194 +0200 --- src/testdir/test_textformat.vim 2020-12-20 12:53:34.348529819 +0100 *** *** 934,939 --- 934,951 call assert_equal('g uu uu ', getline(1)[-8:]) call assert_equal(['uu. foo'], getline(2, '$')) + " using backspace or "x" triggers reformat + call setline(1, ['1 2 3 4 5 ', '6 7 8 9']) + set tw=10 + set fo=taw + set bs=indent,eol,start + exe "normal 1G4la\\\" + call assert_equal(['1 2 4 5 6 ', '7 8 9'], getline(1, 2)) + exe "normal f4xx" + call assert_equal(['1 2 5 6 7 ', '8 9'], getline(1, 2)) + + set tw=0 + set fo& %bw! endfunc *** ../vim-8.2.2165/src/version.c 2020-12-19 22:10:09.861835442 +0100 --- src/version.c 2020-12-20 13:02:11.910940256 +0100 *** *** 752,753 --- 752,755 { /* Add new patch number below this line */ + /**/ + 2166, /**/ -- Team-building exercises come in many forms but they all trace their roots back to the prison system. In your typical team-building exercise the employees are subjected to a variety of unpleasant situations until they become either a cohesive team or a ring of car jackers. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- b...@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/// -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202012201208.0BKC8CRM1860287%40masaka.moolenaar.net.