Patch 8.2.4580

5 views
Skip to first unread message

Bram Moolenaar

unread,
Mar 16, 2022, 1:54:54 PM3/16/22
to vim...@googlegroups.com

Patch 8.2.4580
Problem: Vim9: incorrect error for shadowing variable.
Solution: Do not pass the context when compiling a referenced function.
Files: src/vim9expr.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.4579/src/vim9expr.c 2022-03-15 19:29:26.546954678 +0000
--- src/vim9expr.c 2022-03-16 17:51:56.024423998 +0000
***************
*** 364,370 ****
// Need to compile any default values to get the argument types.
compile_type = get_compile_type(ufunc);
if (func_needs_compiling(ufunc, compile_type)
! && compile_def_function(ufunc, TRUE, compile_type, cctx) == FAIL)
return FAIL;
return generate_PUSHFUNC(cctx, ufunc->uf_name, ufunc->uf_func_type);
}
--- 364,370 ----
// Need to compile any default values to get the argument types.
compile_type = get_compile_type(ufunc);
if (func_needs_compiling(ufunc, compile_type)
! && compile_def_function(ufunc, TRUE, compile_type, NULL) == FAIL)
return FAIL;
return generate_PUSHFUNC(cctx, ufunc->uf_name, ufunc->uf_func_type);
}
*** ../vim-8.2.4579/src/testdir/test_vim9_func.vim 2022-03-15 12:28:06.041374341 +0000
--- src/testdir/test_vim9_func.vim 2022-03-16 17:51:19.452575046 +0000
***************
*** 2999,3004 ****
--- 2999,3022 ----
assert_equal([42], g:Shadowed())
enddef

+ def Test_compiling_referenced_func_no_shadow()
+ var lines =<< trim END
+ vim9script
+
+ def InitializeReply(lspserver: dict<any>)
+ enddef
+
+ def ProcessReply(lspserver: dict<any>)
+ var lsp_reply_handlers: dict<func> =
+ { 'initialize': InitializeReply }
+ lsp_reply_handlers['initialize'](lspserver)
+ enddef
+
+ call ProcessReply({})
+ END
+ v9.CheckScriptSuccess(lines)
+ enddef
+
def s:Line_continuation_in_def(dir: string = ''): string
var path: string = empty(dir)
\ ? 'empty'
*** ../vim-8.2.4579/src/version.c 2022-03-16 13:33:22.078467971 +0000
--- src/version.c 2022-03-16 17:53:04.096145486 +0000
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4580,
/**/

--
Ten bugs in the hand is better than one as yet undetected.

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages