Mercurial > vim
comparison src/testdir/test_vim9_expr.vim @ 23013:a0a998d2e443 v8.2.2053
patch 8.2.2053: Vim9: lamba doesn't accept argument types
Commit: https://github.com/vim/vim/commit/c2ca935d26b3fc64a13d4e7d0583fc787efe61d0
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Nov 25 21:30:11 2020 +0100
patch 8.2.2053: Vim9: lamba doesn't accept argument types
Problem: Vim9: lamba doesn't accept argument types.
Solution: Optionally accept argument types at the script level.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 25 Nov 2020 21:45:04 +0100 |
parents | 00b0275ffe7f |
children | 6a70803f4cbe |
comparison
equal
deleted
inserted
replaced
23012:11abae1d1ce9 | 23013:a0a998d2e443 |
---|---|
1826 assert_equal(true, LambdaWithComments()(2)) | 1826 assert_equal(true, LambdaWithComments()(2)) |
1827 assert_equal(false, LambdaWithComments()(3)) | 1827 assert_equal(false, LambdaWithComments()(3)) |
1828 | 1828 |
1829 assert_equal(false, LambdaUsingArg(0)()) | 1829 assert_equal(false, LambdaUsingArg(0)()) |
1830 assert_equal(true, LambdaUsingArg(1)()) | 1830 assert_equal(true, LambdaUsingArg(1)()) |
1831 | |
1832 var res = map([1, 2, 3], {i: number, v: number -> i + v}) | |
1833 assert_equal([1, 3, 5], res) | |
1831 END | 1834 END |
1832 CheckDefAndScriptSuccess(lines) | 1835 CheckDefAndScriptSuccess(lines) |
1833 | 1836 |
1834 CheckDefFailure(["filter([1, 2], {k,v -> 1})"], 'E1069:', 1) | 1837 CheckDefFailure(["filter([1, 2], {k,v -> 1})"], 'E1069:', 1) |
1835 # error is in first line of the lambda | 1838 # error is in first line of the lambda |