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 -- [email protected] -- 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220316175448.9F8A81C0497%40moolenaar.net.