patch 8.2.4682: Vim9: can use :unlockvar for const variable
Problem: Vim9: can use :unlockvar for const variable. (Ernie Rael)
Solution: Check whether the variable is a const.
diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim
index 8dea71d..49ca29b 100644
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -1650,6 +1650,23 @@
LockIt()
END
v9.CheckScriptFailure(lines, 'E1246', 1)
+
+ lines =<< trim END
+ vim9script
+ const name = 'john'
+ unlockvar name
+ END
+ v9.CheckScriptFailure(lines, 'E46', 3)
+
+ lines =<< trim END
+ vim9script
+ const name = 'john'
+ def UnLockIt()
+ unlockvar name
+ enddef
+ UnLockIt()
+ END
+ v9.CheckScriptFailure(lines, 'E46', 1)
enddef
def Test_substitute_expr()