To: vim_dev@googlegroups.com Subject: Patch 8.2.2758 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2758 Problem: Vim9: wrong line number for autoload function with wrong name. Solution: Set and restore SOURCING_LNUM. (closes #8100) Files: src/userfunc.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.2757/src/userfunc.c 2021-04-10 21:38:35.451959655 +0200 --- src/userfunc.c 2021-04-12 21:57:56.808855222 +0200 *************** *** 4058,4064 **** --- 4058,4068 ---- } if (j == FAIL) { + linenr_T save_lnum = SOURCING_LNUM; + + SOURCING_LNUM = sourcing_lnum_top; semsg(_("E746: Function name does not match script file name: %s"), name); + SOURCING_LNUM = save_lnum; goto erret; } } *** ../vim-8.2.2757/src/testdir/test_vim9_func.vim 2021-04-10 21:01:35.017507340 +0200 --- src/testdir/test_vim9_func.vim 2021-04-12 21:57:08.232932427 +0200 *************** *** 74,79 **** --- 74,103 ---- delete('Xdir', 'rf') enddef + def Test_autoload_name_mismatch() + var dir = 'Xdir/autoload' + mkdir(dir, 'p') + + var lines =<< trim END + vim9script + def scriptX#Function() + # comment + g:runtime = 'yes' + enddef + END + writefile(lines, dir .. '/script.vim') + + var save_rtp = &rtp + exe 'set rtp=' .. getcwd() .. '/Xdir' + lines =<< trim END + call script#Function() + END + CheckScriptFailure(lines, 'E746:', 2) + + &rtp = save_rtp + delete(dir, 'rf') + enddef + def CallRecursive(n: number): number return CallRecursive(n + 1) enddef *** ../vim-8.2.2757/src/version.c 2021-04-12 21:20:58.638708968 +0200 --- src/version.c 2021-04-12 21:54:20.941185262 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2758, /**/ -- From "know your smileys": % Bike accident. A bit far-fetched, I suppose; although... o _ _ _ _o /\_ _ \\o (_)\__/o (_) _< \_ _>(_) (_)/<_ \_| \ _|/' \/ (_)>(_) (_) (_) (_) (_)' _\o_ /// Bram Moolenaar -- Bram@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 ///