0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.3682: Vim9: assigning to a script variable drops the type

Problem:    Vim9: assigning to a script variable drops the required type.
Solution:   Lookup the type of the variable and use it. (closes #9219)
This commit is contained in:
Bram Moolenaar
2021-11-26 17:36:51 +00:00
parent bfc5786a61
commit 7824fc80f6
5 changed files with 40 additions and 28 deletions

View File

@@ -322,6 +322,16 @@ def Test_skipped_assignment()
CheckDefAndScriptSuccess(lines)
enddef
def Test_assign_keep_type()
var lines =<< trim END
vim9script
var l: list<number> = [123]
l = [123]
l->add('string')
END
CheckScriptFailure(lines, 'E1012:', 4)
enddef
def Test_assign_unpack()
var lines =<< trim END
var v1: number