Mercurial > vim
diff src/testdir/test_vim9_func.vim @ 27519:7898c7847293 v8.2.4287
patch 8.2.4287: cannot assign empty list with type to variable with list type
Commit: https://github.com/vim/vim/commit/2d3ac2e03093c4b0ae5d18c5f2f51ae0c2a9ec72
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Feb 3 12:34:05 2022 +0000
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 03 Feb 2022 13:45:03 +0100 |
parents | 55613f0d59bc |
children | 0b12dd90a5d6 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -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)