To: vim_dev@googlegroups.com Subject: Patch 8.2.2965 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2965 Problem: Vim9: crash when calling function that failed to compile. Solution: Fail when trying to call the function. (closes #8344) Files: src/errors.h, src/vim9compile.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.2964/src/errors.h 2021-06-05 18:15:06.610037272 +0200 --- src/errors.h 2021-06-08 21:49:07.048017239 +0200 *************** *** 423,425 **** --- 423,427 ---- INIT(= N_("E1190: One argument too few")); EXTERN char e_nr_arguments_too_few[] INIT(= N_("E1190: %d arguments too few")); + EXTERN char e_call_to_function_that_failed_to_compile_str[] + INIT(= N_("E1191: Call to function that failed to compile: %s")); *** ../vim-8.2.2964/src/vim9compile.c 2021-06-08 20:46:42.130585681 +0200 --- src/vim9compile.c 2021-06-08 21:50:14.219887872 +0200 *************** *** 1950,1955 **** --- 1950,1961 ---- PROFILING(ufunc), NULL) == FAIL) return FAIL; } + if (ufunc->uf_def_status == UF_COMPILE_ERROR) + { + emsg_funcname(_(e_call_to_function_that_failed_to_compile_str), + ufunc->uf_name); + return FAIL; + } if ((isn = generate_instr(cctx, ufunc->uf_def_status != UF_NOT_COMPILED ? ISN_DCALL *** ../vim-8.2.2964/src/testdir/test_vim9_func.vim 2021-06-06 17:02:49.753789485 +0200 --- src/testdir/test_vim9_func.vim 2021-06-08 21:57:30.123040943 +0200 *************** *** 74,79 **** --- 74,95 ---- delete('Xdir', 'rf') enddef + def Test_compile_error_in_called_function() + var lines =<< trim END + vim9script + var n: number + def Foo() + &hls = n + enddef + def Bar() + Foo() + enddef + silent! Foo() + Bar() + END + CheckScriptFailureList(lines, ['E1012:', 'E1191:']) + enddef + def Test_autoload_name_mismatch() var dir = 'Xdir/autoload' mkdir(dir, 'p') *** ../vim-8.2.2964/src/version.c 2021-06-08 20:46:42.130585681 +0200 --- src/version.c 2021-06-08 21:50:11.811892516 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2965, /**/ -- Clothes make the man. Naked people have little or no influence on society. -- Mark Twain (Samuel Clemens) (1835-1910) /// 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 ///