Skip to content

Commit 12be734

Browse files
committed
patch 8.2.2681: Vim9: test fails for redeclaring script variable
Problem: Vim9: test fails for redeclaring script variable. Solution: It's OK to assign to an existing script variable in legacy.
1 parent e535db8 commit 12be734

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/evalvars.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3219,16 +3219,17 @@ set_var_const(
32193219
goto failed;
32203220
}
32213221

3222+
if (is_script_local && vim9script
3223+
&& (flags & (ASSIGN_NO_DECL | ASSIGN_DECL)) == 0)
3224+
{
3225+
semsg(_(e_redefining_script_item_str), name);
3226+
goto failed;
3227+
}
3228+
32223229
if (var_in_vim9script)
32233230
{
32243231
where_T where;
32253232

3226-
if ((flags & (ASSIGN_NO_DECL | ASSIGN_DECL)) == 0)
3227-
{
3228-
semsg(_(e_redefining_script_item_str), name);
3229-
goto failed;
3230-
}
3231-
32323233
// check the type and adjust to bool if needed
32333234
where.wt_index = var_idx;
32343235
where.wt_variable = TRUE;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2681,
753755
/**/
754756
2680,
755757
/**/

0 commit comments

Comments
 (0)