0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.2692: Vim9: locked script variable can be changed

Problem:    Vim9: locked script variable can be changed.
Solution:   Check for locked value. (closes #8031)
This commit is contained in:
Bram Moolenaar
2021-04-02 14:35:15 +02:00
parent 3fa5e64e0e
commit f5906aa780
3 changed files with 20 additions and 0 deletions

View File

@@ -1346,6 +1346,17 @@ def Test_var_declaration_fails()
CheckScriptFailure(lines, 'E741:')
unlet g:constvar
lines =<< trim END
vim9script
var name = 'one'
lockvar name
def SetLocked()
name = 'two'
enddef
SetLocked()
END
CheckScriptFailure(lines, 'E741: Value is locked: name')
lines =<< trim END
vim9script
def SetGlobalConst()