Mercurial > vim
comparison src/testdir/test_vim9_assign.vim @ 27406:4c1bdee75bed v8.2.4231
patch 8.2.4231: Vim9: map() gives type error when type was not declared
Commit: https://github.com/vim/vim/commit/35c807df1f5774f09612d756ddc3cd5c44eacaca
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 27 16:36:29 2022 +0000
patch 8.2.4231: Vim9: map() gives type error when type was not declared
Problem: Vim9: map() gives type error when type was not declared.
Solution: Only check the type when it was declared, like extend() does.
(closes #9635)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 27 Jan 2022 17:45:03 +0100 |
parents | 6ed31017c303 |
children | 4c16acb2525f |
comparison
equal
deleted
inserted
replaced
27405:9265a363d1ab | 27406:4c1bdee75bed |
---|---|
1961 | 1961 |
1962 var lines =<< trim END | 1962 var lines =<< trim END |
1963 var ll: list<number> | 1963 var ll: list<number> |
1964 ll = [1, 2, 3]->map('"one"') | 1964 ll = [1, 2, 3]->map('"one"') |
1965 END | 1965 END |
1966 CheckDefExecFailure(lines, 'E1012: Type mismatch; expected number but got string') | 1966 CheckDefExecFailure(lines, 'E1012: Type mismatch; expected list<number> but got list<string>') |
1967 enddef | 1967 enddef |
1968 | 1968 |
1969 def Test_cannot_use_let() | 1969 def Test_cannot_use_let() |
1970 CheckDefAndScriptFailure(['let a = 34'], 'E1126:', 1) | 1970 CheckDefAndScriptFailure(['let a = 34'], 'E1126:', 1) |
1971 enddef | 1971 enddef |