Problem: Failing tests for :const.
Solution: Add missing check for ASSIGN_FINAL.
{
typval_T tv;
- if (flags & ASSIGN_CONST)
+ if (flags & (ASSIGN_CONST | ASSIGN_FINAL))
{
emsg(_(e_cannot_mod));
*endp = cc;
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;
/*
* 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;
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;
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
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
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2195,
/**/
2194,
/**/