changeset 27271:b760dfee1bd7 v8.2.4164

patch 8.2.4164: error in legacy code for function shadowing variable Commit: https://github.com/vim/vim/commit/6f0ddbf00dfc4c6eb70aa4abc415cad7aba46b6a Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 20 19:56:49 2022 +0000 patch 8.2.4164: error in legacy code for function shadowing variable Problem: Error in legacy code for function shadowing variable. Solution: Only give the error in Vim9 script.
author Bram Moolenaar <Bram@vim.org>
date Thu, 20 Jan 2022 21:00:06 +0100
parents 4eeec304acf6
children 09a65231156f
files src/userfunc.c src/version.c
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -4466,7 +4466,7 @@ define_function(exarg_T *eap, char_u *na
 	int		var_conflict = FALSE;
 
 	v = find_var(name, &ht, TRUE);
-	if (v != NULL)
+	if (v != NULL && (in_vim9script() || v->di_tv.v_type == VAR_FUNC))
 	    var_conflict = TRUE;
 
 	if (SCRIPT_ID_VALID(current_sctx.sc_sid))
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4164,
+/**/
     4163,
 /**/
     4162,