comparison src/testdir/test_vim9_assign.vim @ 24305:c88d0b5c5a42 v8.2.2693

patch 8.2.2693: Vim9: locked script variable can be changed Commit: https://github.com/vim/vim/commit/dcf29ac87f4d7a62c503ba6de0d92c7779446bf2 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Apr 2 14:44:02 2021 +0200 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 https://github.com/vim/vim/issues/8031)
author Bram Moolenaar <Bram@vim.org>
date Fri, 02 Apr 2021 14:45:07 +0200
parents 17b49af76766
children 52a0e187264b
comparison
equal deleted inserted replaced
24304:a78acfe60b4e 24305:c88d0b5c5a42
1353 def SetLocked() 1353 def SetLocked()
1354 name = 'two' 1354 name = 'two'
1355 enddef 1355 enddef
1356 SetLocked() 1356 SetLocked()
1357 END 1357 END
1358 CheckScriptFailure(lines, 'E741: Value is locked: name') 1358 CheckScriptFailure(lines, 'E741: Value is locked: name', 1)
1359
1360 lines =<< trim END
1361 let s:legacy = 'one'
1362 lockvar s:legacy
1363 def SetLocked()
1364 s:legacy = 'two'
1365 enddef
1366 call SetLocked()
1367 END
1368 CheckScriptFailure(lines, 'E741: Value is locked: s:legacy', 1)
1359 1369
1360 lines =<< trim END 1370 lines =<< trim END
1361 vim9script 1371 vim9script
1362 def SetGlobalConst() 1372 def SetGlobalConst()
1363 const g:globConst = 123 1373 const g:globConst = 123
1364 enddef 1374 enddef
1365 SetGlobalConst() 1375 SetGlobalConst()
1366 g:globConst = 234 1376 g:globConst = 234
1367 END 1377 END
1368 CheckScriptFailure(lines, 'E741: Value is locked: globConst') 1378 CheckScriptFailure(lines, 'E741: Value is locked: globConst', 1)
1369 unlet g:globConst 1379 unlet g:globConst
1370 1380
1371 lines =<< trim END 1381 lines =<< trim END
1372 vim9script 1382 vim9script
1373 const cdict: dict<string> = {} 1383 const cdict: dict<string> = {}