1
0
forked from aniani/vim

patch 8.2.2193: Vim9: can change constant in :def function

Problem:    Vim9: can change constant in :def function.
Solution:   Check if a variable is locked. (issue #7526)
This commit is contained in:
Bram Moolenaar
2020-12-22 20:35:40 +01:00
parent e5492609b3
commit 3bdc90b7df
5 changed files with 39 additions and 10 deletions

View File

@@ -1022,6 +1022,17 @@ def Test_vim9script_call_fail_const()
writefile(lines, 'Xcall_const.vim')
assert_fails('source Xcall_const.vim', 'E46:', '', 1, 'MyFunc')
delete('Xcall_const.vim')
lines =<< trim END
const g:Aconst = 77
def Change()
# comment
g:Aconst = 99
enddef
call Change()
unlet g:Aconst
END
CheckScriptFailure(lines, 'E741: Value is locked: Aconst', 2)
enddef
" Test that inside :function a Python function can be defined, :def is not