mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.2.2693: Vim9: locked script variable can be changed
Problem: Vim9: locked script variable can be changed. Solution: Check legacy script variable for being locked. (issue #8031)
This commit is contained in:
@@ -1355,7 +1355,17 @@ def Test_var_declaration_fails()
|
||||
enddef
|
||||
SetLocked()
|
||||
END
|
||||
CheckScriptFailure(lines, 'E741: Value is locked: name')
|
||||
CheckScriptFailure(lines, 'E741: Value is locked: name', 1)
|
||||
|
||||
lines =<< trim END
|
||||
let s:legacy = 'one'
|
||||
lockvar s:legacy
|
||||
def SetLocked()
|
||||
s:legacy = 'two'
|
||||
enddef
|
||||
call SetLocked()
|
||||
END
|
||||
CheckScriptFailure(lines, 'E741: Value is locked: s:legacy', 1)
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
@@ -1365,7 +1375,7 @@ def Test_var_declaration_fails()
|
||||
SetGlobalConst()
|
||||
g:globConst = 234
|
||||
END
|
||||
CheckScriptFailure(lines, 'E741: Value is locked: globConst')
|
||||
CheckScriptFailure(lines, 'E741: Value is locked: globConst', 1)
|
||||
unlet g:globConst
|
||||
|
||||
lines =<< trim END
|
||||
|
Reference in New Issue
Block a user