forked from aniani/vim
patch 8.2.2195: failing tests for :const
Problem: Failing tests for :const. Solution: Add missing check for ASSIGN_FINAL.
This commit is contained in:
@@ -1334,7 +1334,7 @@ set_var_lval(
|
||||
{
|
||||
typval_T tv;
|
||||
|
||||
if (flags & ASSIGN_CONST)
|
||||
if (flags & (ASSIGN_CONST | ASSIGN_FINAL))
|
||||
{
|
||||
emsg(_(e_cannot_mod));
|
||||
*endp = cc;
|
||||
@@ -1372,7 +1372,7 @@ set_var_lval(
|
||||
listitem_T *ll_li = lp->ll_li;
|
||||
int ll_n1 = lp->ll_n1;
|
||||
|
||||
if (flags & ASSIGN_CONST)
|
||||
if (flags & (ASSIGN_CONST | ASSIGN_FINAL))
|
||||
{
|
||||
emsg(_("E996: Cannot lock a range"));
|
||||
return;
|
||||
@@ -1431,7 +1431,7 @@ set_var_lval(
|
||||
/*
|
||||
* Assign to a List or Dictionary item.
|
||||
*/
|
||||
if (flags & ASSIGN_CONST)
|
||||
if (flags & (ASSIGN_CONST | ASSIGN_FINAL))
|
||||
{
|
||||
emsg(_("E996: Cannot lock a list or dict"));
|
||||
return;
|
||||
|
@@ -752,9 +752,6 @@ ex_let(exarg_T *eap)
|
||||
emsg(_(e_cannot_use_let_in_vim9_script));
|
||||
return;
|
||||
}
|
||||
if (eap->cmdidx == CMD_const && !vim9script && !eap->forceit)
|
||||
// In legacy Vim script ":const" works like ":final".
|
||||
eap->cmdidx = CMD_final;
|
||||
|
||||
if (eap->cmdidx == CMD_const)
|
||||
flags |= ASSIGN_CONST;
|
||||
@@ -3231,7 +3228,8 @@ set_var_const(
|
||||
init_tv(tv);
|
||||
}
|
||||
|
||||
// ":const var = val" locks the value
|
||||
// ":const var = value" locks the value
|
||||
// ":final var = value" locks "var"
|
||||
if (flags & ASSIGN_CONST)
|
||||
// Like :lockvar! name: lock the value and what it contains, but only
|
||||
// if the reference count is up to one. That locks only literal
|
||||
|
@@ -1032,7 +1032,7 @@ def Test_vim9script_call_fail_const()
|
||||
call Change()
|
||||
unlet g:Aconst
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1122: Variable is locked: Aconst', 2)
|
||||
CheckScriptFailure(lines, 'E741: Value is locked: Aconst', 2)
|
||||
enddef
|
||||
|
||||
" Test that inside :function a Python function can be defined, :def is not
|
||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2195,
|
||||
/**/
|
||||
2194,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user