forked from aniani/vim
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:
@@ -3461,11 +3461,11 @@ def Test_list_any_type_checked()
|
||||
enddef
|
||||
Foo()
|
||||
END
|
||||
# "any" could be "dict<any>", thus OK
|
||||
lines[2] = 'var l: list<any>'
|
||||
v9.CheckScriptFailure(lines, 'E1013: Argument 1: type mismatch, expected list<dict<any>> but got list<any>', 2)
|
||||
|
||||
v9.CheckScriptSuccess(lines)
|
||||
lines[2] = 'var l: list<any> = []'
|
||||
v9.CheckScriptFailure(lines, 'E1013: Argument 1: type mismatch, expected list<dict<any>> but got list<any>', 2)
|
||||
v9.CheckScriptSuccess(lines)
|
||||
|
||||
lines[2] = 'var l: list<any> = [11]'
|
||||
v9.CheckScriptFailure(lines, 'E1013: Argument 1: type mismatch, expected list<dict<any>> but got list<number>', 2)
|
||||
|
||||
Reference in New Issue
Block a user