Re: E315 error when opening two specific files in vim
On Mo, 26 Dez 2022, JD Allen wrote: > > It only seems to affect two specific files, and only when I open them in this > particular way: > > vim -p file1 file2 > > When I do this I get the following output: > > E315: ml_get: Invalid lnum 3467 > E315: ml_get: Invalid lnum 3467 > E315: ml_get: Invalid lnum 3468 > E315: ml_get: Invalid lnum 3469 > E315: ml_get: Invalid lnum 3470 > > If I open file1 by itself, or file2 by itself, I get no error. > > Also: if I rename one of the files and then open them with: > > vim -p renamed-file1 file2 > > I get no error. But if I then change the name back to the original file1 and > try again, i now get: > > E315: ml_get: invalid lnum: 2 > > Finally, (excuse the convolutions) if I do the following: > -rename file1 > -touch file1 > -open: vim -p file1 file2 (no error) > -close vim > -delete file1 > -change renamed file back to file1 > -open: vim -p file1 file2 > > I get no error, and it would appear the problem is fixed, however after > restarting the OS the original problem returns all over again. > > vim version: 9.0.1046-1 > > environment: arch linux First question: Does it occur when running `vim --clean` (e.g. with a default set of options and no plugins involved). If yes, there is something seriously wrong, so I assume it's some plugin going wrong here. So what kind of plugins are you using? Also, does your viminfo file contains references to those files? Best, Christian -- Warum überquerte das Huhn die Straße? Plato: Für ein bedeutenderes Gut. -- -- 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/20221227083323.GA220345%40256bit.org.
Re: Choices for Vim9 class implementation
On Mon, 26 Dec 2022 at 02:02, Bram Moolenaar wrote: [...] > > This following currently defines a field and is, without context, > > indistinguishable from any other assignment. Is that intended? > > With "var" it's indistinguishable from another declaration, I don't > think it matters much that it looks like an assignment otherwise. > There's only one declaration per class assuming either a qualified name is used in the declaration or normal shadowing rules apply. So, ignoring subjective aesthetic issues, this would allow for tooling to more easily identify the declaration. [...] > > It seems from the documentation that static fields can be referenced as > > bare identifiers? This feels a bit unexpected to me given that instance > > fields are always qualified. > > Static fields (class members) are totally different from object members. > I have always found it confusing, in many languages it's hard to tell > them apart, especially if the declaration is further away. Always using > "this" for object members helps a lot for this. I would not know what > to use for class members. The only thing I have seen is using the class > name, which can be long (and gets tricky when using inheritance). > I believe most languages access class members directly, without a > prefix. > I think they're much the same in terms of the problems the required "this" qualifier is attempting to address. Static fields also need disambiguation in shadowed contexts and could, arguably, also use better identification. Are methods going to need to be qualified too? Cards on the table, I'm not in favour of requiring qualified references. I just found it surprising that only unqualified instance fields were considered a problem. Regards, Doug -- -- 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/CAJ1uvoBEMBLsh1%2B8y-b%2BPw8uLi3VZtRNAob-PNV22ugNNt9fdQ%40mail.gmail.com.
Re: Choices for Vim9 class implementation
> > > This following currently defines a field and is, without context, > > > indistinguishable from any other assignment. Is that intended? > > > > With "var" it's indistinguishable from another declaration, I don't > > think it matters much that it looks like an assignment otherwise. > > > > There's only one declaration per class assuming either a qualified name is > used in the declaration or normal shadowing rules apply. > > So, ignoring subjective aesthetic issues, this would allow for tooling to > more easily identify the declaration. Yes, there are some reasons to declare object members with "var". It's hard to decide what matters most. Perhaps "making it look like a declaration" is more important than other reasons. The space taken up by the extra "var" keyword probably doesn't matter much. > > > It seems from the documentation that static fields can be referenced as > > > bare identifiers? This feels a bit unexpected to me given that instance > > > fields are always qualified. > > > > Static fields (class members) are totally different from object members. > > I have always found it confusing, in many languages it's hard to tell > > them apart, especially if the declaration is further away. Always using > > "this" for object members helps a lot for this. I would not know what > > to use for class members. The only thing I have seen is using the class > > name, which can be long (and gets tricky when using inheritance). > > I believe most languages access class members directly, without a > > prefix. > > I think they're much the same in terms of the problems the required "this" > qualifier is attempting to address. Static fields also need disambiguation > in shadowed contexts and could, arguably, also use better identification. Assigning to a static class member in a constructor is unusual, thus the common problem that an argument name matches a member name is unlikely to happen for a class member. We could probably disallow shadowing a class member. We can at least start with that and see if that doesn't cause annoyance. > Are methods going to need to be qualified too? Object methods are always called on an object "obj.method()". I suppose "this.method()" also works (don't see this very often). Just using "method()" probably needs to be disallowed. Especially if we require prefixing "this." for object members. > Cards on the table, I'm not in favour of requiring qualified > references. I just found it surprising that only unqualified instance > fields were considered a problem. That is the reality. All this is much more about what a developer encounters on a regular basis than theory or philosophy. Especially when it comes to what mistakes people tend to make and whether it's possible to give a helpful error for them. Every time I have started using a new language (usually advertised as being the best ever) I have run into things that don't work well in practice. -- ARTHUR: Charge! [They all charge with swords drawn towards the RABBIT. A tremendous twenty second fight with Peckinpahish shots and borrowing heavily also on the Kung Fu and karate-type films ensues, in which some four KNIGHTS are comprehensively killed.] ARTHUR: Run away! Run away! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\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/20221227162916.A4C041C0AA3%40moolenaar.net.
Patch 9.0.1104
Patch 9.0.1104 Problem:Invalid memory access when checking function argument types. Solution: Do not check beyond the number of arguments. (closes #11755) Files: src/vim9type.c, src/testdir/test_vim9_func.vim *** ../vim-9.0.1103/src/vim9type.c 2022-12-13 21:14:19.219930894 + --- src/vim9type.c 2022-12-27 17:02:14.991264919 + *** *** 848,854 { int i; ! for (i = 0; i < expected->tt_argcount; ++i) // Allow for using "any" argument type, lambda's have them. if (actual->tt_args[i] != &t_any && check_type( expected->tt_args[i], actual->tt_args[i], FALSE, --- 848,854 { int i; ! for (i = 0; i < expected->tt_argcount && i < actual->tt_argcount; ++i) // Allow for using "any" argument type, lambda's have them. if (actual->tt_args[i] != &t_any && check_type( expected->tt_args[i], actual->tt_args[i], FALSE, *** ../vim-9.0.1103/src/testdir/test_vim9_func.vim 2022-12-02 18:12:01.022476815 + --- src/testdir/test_vim9_func.vim 2022-12-27 17:15:05.182570957 + *** *** 426,431 --- 426,441 Func() END v9.CheckScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected number but got bool', 2) + + lines =<< trim END + vim9script + + def Foobar(Fn: func(any, ?string): any) + enddef + + Foobar((t) => 0) + END + v9.CheckScriptSuccess(lines) enddef def Test_missing_return() *** ../vim-9.0.1103/src/version.c 2022-12-26 15:35:11.357868057 + --- src/version.c 2022-12-27 17:09:39.214852769 + *** *** 697,698 --- 697,700 { /* Add new patch number below this line */ + /**/ + 1104, /**/ -- ROBIN: The what? ARTHUR: The Holy Hand Grenade of Antioch. 'Tis one of the sacred relics Brother Maynard always carries with him. ALL:Yes. Of course. ARTHUR: (shouting) Bring up the Holy Hand Grenade! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\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/20221227172640.1731C1C0AA3%40moolenaar.net.
Patch 9.0.1105
Patch 9.0.1105 Problem:Code is indented too much. Solution: Use an early return. (Yegappan Lakshmanan, closes #11756) Files: src/dict.c, src/edit.c, src/eval.c *** ../vim-9.0.1104/src/dict.c 2022-11-25 16:31:46.964606667 + --- src/dict.c 2022-12-27 19:38:02.329049265 + *** *** 1270,1319 return; } d2 = argvars[1].vval.v_dict; ! if ((is_new || !value_check_lock(d1->dv_lock, arg_errmsg, TRUE)) ! && d2 != NULL) ! { ! if (is_new) ! { ! d1 = dict_copy(d1, FALSE, TRUE, get_copyID()); ! if (d1 == NULL) ! return; ! } ! ! // Check the third argument. ! if (argvars[2].v_type != VAR_UNKNOWN) ! { ! static char *(av[]) = {"keep", "force", "error"}; ! action = tv_get_string_chk(&argvars[2]); ! if (action == NULL) ! return; ! for (i = 0; i < 3; ++i) ! if (STRCMP(action, av[i]) == 0) ! break; ! if (i == 3) ! { ! semsg(_(e_invalid_argument_str), action); ! return; ! } ! } ! else ! action = (char_u *)"force"; ! if (type != NULL && check_typval_arg_type(type, &argvars[1], !func_name, 2) == FAIL) return; ! dict_extend(d1, d2, action, func_name); ! if (is_new) { ! rettv->v_type = VAR_DICT; ! rettv->vval.v_dict = d1; ! rettv->v_lock = FALSE; } - else - copy_tv(&argvars[0], rettv); } } /* --- 1270,1321 return; } d2 = argvars[1].vval.v_dict; ! if (d2 == NULL) ! return; ! if (!is_new && value_check_lock(d1->dv_lock, arg_errmsg, TRUE)) ! return; ! if (is_new) ! { ! d1 = dict_copy(d1, FALSE, TRUE, get_copyID()); ! if (d1 == NULL) return; ! } ! // Check the third argument. ! if (argvars[2].v_type != VAR_UNKNOWN) ! { ! static char *(av[]) = {"keep", "force", "error"}; ! ! action = tv_get_string_chk(&argvars[2]); ! if (action == NULL) ! return; ! for (i = 0; i < 3; ++i) ! if (STRCMP(action, av[i]) == 0) ! break; ! if (i == 3) { ! semsg(_(e_invalid_argument_str), action); ! return; } } + else + action = (char_u *)"force"; + + if (type != NULL && check_typval_arg_type(type, &argvars[1], + func_name, 2) == FAIL) + return; + dict_extend(d1, d2, action, func_name); + + if (is_new) + { + rettv->v_type = VAR_DICT; + rettv->vval.v_dict = d1; + rettv->v_lock = FALSE; + } + else + copy_tv(&argvars[0], rettv); } /* *** ../vim-9.0.1104/src/edit.c 2022-12-08 21:49:09.844530541 + --- src/edit.c 2022-12-27 19:38:02.329049265 + *** *** 1664,1712 { int attr; ! if (ScreenLines != NULL) ! { ! update_topline(); // just in case w_topline isn't valid ! validate_cursor(); ! if (highlight) ! attr = HL_ATTR(HLF_8); ! else ! attr = 0; ! pc_row = W_WINROW(curwin) + curwin->w_wrow; ! pc_col = curwin->w_wincol; ! pc_status = PC_STATUS_UNSET; #ifdef FEAT_RIGHTLEFT ! if (curwin->w_p_rl) { ! pc_col += curwin->w_width - 1 - curwin->w_wcol; ! if (has_mbyte) ! { ! int fix_col = mb_fix_col(pc_col, pc_row); ! if (fix_col != pc_col) ! { ! screen_putchar(' ', pc_row, fix_col, attr); ! --curwin->w_wcol; ! pc_status = PC_STATUS_RIGHT; ! } } } ! else #endif ! { ! pc_col += curwin->w_wcol; ! if (mb_lefthalve(pc_row, pc_col)) ! pc_status = PC_STATUS_LEFT; ! } ! // save the character to be able to put it back ! if (pc_status == PC_STATUS_UNSET) ! { ! screen_getbytes(pc_row, pc_col, pc_bytes, &pc_attr); ! pc_status = PC_STATUS_SET; ! } ! screen_putchar(c, pc_row, pc_col, attr); } } #if defined(FEAT_JOB_CHANNEL) || defined(PROTO) --- 1664,1712 { int attr; ! if (ScreenLines == NULL) ! return; ! ! update_topline(); // just in case w_topline isn't valid ! validate_cursor(); ! if (highlight) ! attr = HL_ATTR(HLF_8); ! else ! attr = 0; ! pc_row = W_WINROW(curwin) + curwin->w_wrow; ! pc_col = curwin->w_wincol; ! pc_status = PC_STATUS_UNSET; #ifdef FEAT_RIGHTLEFT ! if (curwin->w_p_rl) ! { ! pc_col += curwin->w_width - 1 - curwin->w_wcol; ! if (has_mbyte) { ! int fix_col = mb_fix_col(pc_col, p
Patch 9.0.1106
Patch 9.0.1106 Problem:Not all postfix files are recognized. Solution: Recognize main.cf.proto files. (closes #11732) Files: runtime/filetype.vim, src/testdir/test_filetype.vim *** ../vim-9.0.1105/runtime/filetype.vim2022-12-26 15:35:11.357868057 + --- runtime/filetype.vim2022-12-27 20:07:56.529256044 + *** *** 1498,1504 au BufNewFile,BufRead *.po,*.pot setf po " Postfix main config ! au BufNewFile,BufRead main.cf setf pfmain " PostScript (+ font files, encapsulated PostScript, Adobe Illustrator) au BufNewFile,BufRead *.ps,*.pfa,*.afm,*.eps,*.epsf,*.epsi,*.ai setf postscr --- 1498,1504 au BufNewFile,BufRead *.po,*.pot setf po " Postfix main config ! au BufNewFile,BufRead main.cf,main.cf.proto setf pfmain " PostScript (+ font files, encapsulated PostScript, Adobe Illustrator) au BufNewFile,BufRead *.ps,*.pfa,*.afm,*.eps,*.epsf,*.epsi,*.ai setf postscr *** ../vim-9.0.1105/src/testdir/test_filetype.vim 2022-12-26 15:35:11.357868057 + --- src/testdir/test_filetype.vim 2022-12-27 20:07:56.529256044 + *** *** 420,426 \ 'pdf': ['file.pdf'], \ 'perl': ['file.plx', 'file.al', 'file.psgi', 'gitolite.rc', '.gitolite.rc', 'example.gitolite.rc', '.latexmkrc', 'latexmkrc'], \ 'pf': ['pf.conf'], ! \ 'pfmain': ['main.cf'], \ 'php': ['file.php', 'file.php9', 'file.phtml', 'file.ctp', 'file.phpt', 'file.theme'], \ 'pike': ['file.pike', 'file.pmod'], \ 'pilrc': ['file.rcp'], --- 420,426 \ 'pdf': ['file.pdf'], \ 'perl': ['file.plx', 'file.al', 'file.psgi', 'gitolite.rc', '.gitolite.rc', 'example.gitolite.rc', '.latexmkrc', 'latexmkrc'], \ 'pf': ['pf.conf'], ! \ 'pfmain': ['main.cf', 'main.cf.proto'], \ 'php': ['file.php', 'file.php9', 'file.phtml', 'file.ctp', 'file.phpt', 'file.theme'], \ 'pike': ['file.pike', 'file.pmod'], \ 'pilrc': ['file.rcp'], *** ../vim-9.0.1105/src/version.c 2022-12-27 19:54:48.118194735 + --- src/version.c 2022-12-27 20:09:55.685271817 + *** *** 697,698 --- 697,700 { /* Add new patch number below this line */ + /**/ + 1106, /**/ -- An indication you must be a manager: You believe you never have any problems in your life, just "issues" and "improvement opportunities". /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\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/20221227201824.AD9761C0AA3%40moolenaar.net.
Patch 9.0.1107
Patch 9.0.1107 Problem:Float constant not recognized as float. Solution: Check the vartype instead of comparing with t_float. (closes #11754) Files: src/vim9expr.c, src/testdir/test_vim9_expr.vim *** ../vim-9.0.1106/src/vim9expr.c 2022-12-18 21:42:49.014716925 + --- src/vim9expr.c 2022-12-27 20:52:24.052841853 + *** *** 1757,1778 --p; if (*p == '-' || *p == '+') { ! int negate = *p == '-'; ! isn_T *isn; ! type_T *type; ! ! type = get_type_on_stack(cctx, 0); ! if (type != &t_float && need_type(type, &t_number, -1, 0, cctx, FALSE, FALSE) == FAIL) return FAIL; // only '-' has an effect, for '+' we only check the type ! if (negate) ! { ! isn = generate_instr(cctx, ISN_NEGATENR); ! if (isn == NULL) ! return FAIL; ! } } else if (numeric_only) { --- 1757,1770 --p; if (*p == '-' || *p == '+') { ! type_T *type = get_type_on_stack(cctx, 0); ! if (type->tt_type != VAR_FLOAT && need_type(type, &t_number, -1, 0, cctx, FALSE, FALSE) == FAIL) return FAIL; // only '-' has an effect, for '+' we only check the type ! if (*p == '-' && generate_instr(cctx, ISN_NEGATENR) == NULL) ! return FAIL; } else if (numeric_only) { *** ../vim-9.0.1106/src/testdir/test_vim9_expr.vim 2022-11-12 16:07:01.781944372 + --- src/testdir/test_vim9_expr.vim 2022-12-27 20:49:34.272795131 + *** *** 2045,2050 --- 2045,2057 assert_equal(6, 0x6) assert_equal(15, 0xf) assert_equal(255, 0xff) + + const INFTY = 1.0 / 0.0 + def Test() + assert_equal(1, isinf(INFTY)) + assert_equal(-1, isinf(-INFTY)) + enddef + Test() END v9.CheckDefAndScriptSuccess(lines) enddef *** ../vim-9.0.1106/src/version.c 2022-12-27 20:17:15.809022036 + --- src/version.c 2022-12-27 20:47:43.812723827 + *** *** 697,698 --- 697,700 { /* Add new patch number below this line */ + /**/ + 1107, /**/ -- Lose weight, NEVER Diet again with The "Invisible Weight Loss Patch" (spam e-mail) /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\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/20221227205609.8A0AC1C0AA3%40moolenaar.net.
Re: E315 error when opening two specific files in vim
Thanks for getting back to me. When I run it with clean: vim --clean -p file1 file2, I don't get the error. Does that mean its a plugin problem? I don't know what plugins I have installed. Yes, the files in question show up in .viminfo several times. What should I do next? JD On Tuesday, 27 December 2022 at 19:03:28 UTC+10:30 cbl...@256bit.org wrote: > > On Mo, 26 Dez 2022, JD Allen wrote: > > > > > It only seems to affect two specific files, and only when I open them in > this particular way: > > > > vim -p file1 file2 > > > > When I do this I get the following output: > > > > E315: ml_get: Invalid lnum 3467 > > E315: ml_get: Invalid lnum 3467 > > E315: ml_get: Invalid lnum 3468 > > E315: ml_get: Invalid lnum 3469 > > E315: ml_get: Invalid lnum 3470 > > > > If I open file1 by itself, or file2 by itself, I get no error. > > > > Also: if I rename one of the files and then open them with: > > > > vim -p renamed-file1 file2 > > > > I get no error. But if I then change the name back to the original file1 > and try again, i now get: > > > > E315: ml_get: invalid lnum: 2 > > > > Finally, (excuse the convolutions) if I do the following: > > -rename file1 > > -touch file1 > > -open: vim -p file1 file2 (no error) > > -close vim > > -delete file1 > > -change renamed file back to file1 > > -open: vim -p file1 file2 > > > > I get no error, and it would appear the problem is fixed, however after > restarting the OS the original problem returns all over again. > > > > vim version: 9.0.1046-1 > > > > environment: arch linux > > First question: Does it occur when running `vim --clean` (e.g. with a > default set of options and no plugins involved). If yes, there is > something seriously wrong, so I assume it's some plugin going wrong > here. So what kind of plugins are you using? > Also, does your viminfo file contains references to those files? > > > Best, > Christian > -- > Warum überquerte das Huhn die Straße? > Plato: > Für ein bedeutenderes Gut. > -- -- 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/f7920cca-2306-4642-8972-54b17529b18fn%40googlegroups.com.