0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 8.2.1813: Vim9: can assign wrong type to script dict

Problem:    Vim9: can assign wrong type to script dict. (Christian J.  Robinson)
Solution:   Check the type if known.
This commit is contained in:
Bram Moolenaar
2020-10-08 21:16:42 +02:00
parent 0876c78527
commit 10c65860f8
7 changed files with 77 additions and 25 deletions

View File

@@ -145,6 +145,15 @@ def Test_wrong_type()
CheckDefFailure(['var Ref: string', 'var res = Ref()'], 'E1085:')
enddef
def Test_script_wrong_type()
var lines =<< trim END
vim9script
var s:dict: dict<string>
s:dict['a'] = ['x']
END
CheckScriptFailure(lines, 'E1012: Type mismatch; expected string but got list<string>', 3)
enddef
def Test_const()
CheckDefFailure(['final name = 234', 'name = 99'], 'E1018:')
CheckDefFailure(['final one = 234', 'var one = 99'], 'E1017:')