diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-14 18:15:09 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-14 18:15:09 +0200 |
commit | dbeecb2b6bc5bf90b7345807e0a313fe890a7c7b (patch) | |
tree | ec6d6811457956a75a6deaf63566e0d73690e7ab /src/testdir/test_vim9_script.vim | |
parent | 08052228a72074cdb0165e65f01b2fa8fce867ea (diff) |
patch 8.2.1682: Vim9: const works in an unexpected wayv8.2.1682
Problem: Vim9: const works in an unexpected way.
Solution: ":const" only disallows changing the variable, not the value.
Make "list[0] = 9" work at the script level.
Diffstat (limited to 'src/testdir/test_vim9_script.vim')
-rw-r--r-- | src/testdir/test_vim9_script.vim | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index c0ecad8036..63581818e9 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -821,8 +821,15 @@ enddef def Test_const() CheckDefFailure(['const var = 234', 'var = 99'], 'E1018:') CheckDefFailure(['const one = 234', 'let one = 99'], 'E1017:') + CheckDefFailure(['const list = [1, 2]', 'let list = [3, 4]'], 'E1017:') CheckDefFailure(['const two'], 'E1021:') CheckDefFailure(['const &option'], 'E996:') + + let lines =<< trim END + const list = [1, 2, 3] + list[0] = 4 + END + CheckDefAndScriptSuccess(lines) enddef def Test_range_no_colon() |