]> granicus.if.org Git - vim/commitdiff
patch 8.2.4164: error in legacy code for function shadowing variable v8.2.4164
authorBram Moolenaar <Bram@vim.org>
Thu, 20 Jan 2022 19:56:49 +0000 (19:56 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 20 Jan 2022 19:56:49 +0000 (19:56 +0000)
Problem:    Error in legacy code for function shadowing variable.
Solution:   Only give the error in Vim9 script.

src/userfunc.c
src/version.c

index 680017ca76c42bcdf38e57876cf11e0af88f53fc..5de5dd00f205b7271bf07547f5f375381dc74621 100644 (file)
@@ -4466,7 +4466,7 @@ define_function(exarg_T *eap, char_u *name_arg, garray_T *lines_to_free)
        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))
index 2dd019443a8cbfbe2f2be069cf348dab4beaf689..f2ce6a42b7940ed3327e0ef47c0af06d46a1ed9c 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4164,
 /**/
     4163,
 /**/