0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.1682: Vim9: const works in an unexpected way

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.
This commit is contained in:
Bram Moolenaar
2020-09-14 18:15:09 +02:00
parent 08052228a7
commit dbeecb2b6b
4 changed files with 20 additions and 9 deletions

View File

@@ -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()