0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.4287: cannot assign empty list with type to variable with list type

Problem:    Cannot assign empty list with any list type to variable with
            specific list type.
Solution:   Use unknown list type for empty list if the specified type is any.
This commit is contained in:
Bram Moolenaar
2022-02-03 12:34:05 +00:00
parent 381692b6f1
commit 2d3ac2e030
4 changed files with 19 additions and 4 deletions

View File

@@ -1249,6 +1249,15 @@ def Test_assignment_var_list()
v9.CheckScriptSuccess(lines)
enddef
def Test_assignment_empty_list()
var lines =<< trim END
var l2: list<any> = []
var l: list<string>
l = l2
END
v9.CheckDefAndScriptSuccess(lines)
enddef
def Test_assignment_vim9script()
var lines =<< trim END
vim9script