diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-10-08 21:16:42 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-10-08 21:16:42 +0200 |
commit | 10c65860f83589e0ca2498393d3cfef1115b7fe8 (patch) | |
tree | 5c52d0ded7ae00e522bcff80afff0e20bfed2389 /src/testdir/test_vim9_script.vim | |
parent | 0876c78527469ddf50c23244566dd5bc35004307 (diff) | |
download | vim-git-10c65860f83589e0ca2498393d3cfef1115b7fe8.tar.gz |
patch 8.2.1813: Vim9: can assign wrong type to script dictv8.2.1813
Problem: Vim9: can assign wrong type to script dict. (Christian J. Robinson)
Solution: Check the type if known.
Diffstat (limited to 'src/testdir/test_vim9_script.vim')
-rw-r--r-- | src/testdir/test_vim9_script.vim | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim index 7fc522362..02bc56b2f 100644 --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -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:') |