diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-21 21:48:21 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-21 21:48:21 +0200 |
commit | dbd759309b4b6abea96b18d61770e100cf4264b5 (patch) | |
tree | 712bab74dbb71b8b3e33ad39a30931718a723968 /src/testdir/test_vim9_expr.vim | |
parent | 7f9c9c51a3680f120e1c3f2bb7239c9fa115b27f (diff) | |
download | vim-git-dbd759309b4b6abea96b18d61770e100cf4264b5.tar.gz |
patch 8.2.1722: Vim9: cannot assign a lambda to a variable of type functionv8.2.1722
Problem: Vim9: cannot assign a lambda to a variable of type function.
Solution: Allow for assigning a partial to a variable of type function.
(Naruhiko Nishino, closes #6996)
Diffstat (limited to 'src/testdir/test_vim9_expr.vim')
-rw-r--r-- | src/testdir/test_vim9_expr.vim | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim index 411ed7017..7900dd794 100644 --- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -1687,6 +1687,18 @@ def Test_expr7_lambda_vim9script() ->map({_, v -> synIDattr(v, 'name')})->len()}) END CheckScriptSuccess(lines) + + # check if assign a lambda to a variable which type is func or any. + lines =<< trim END + vim9script + let FuncRef = {->123} + assert_equal(123, FuncRef()) + let FuncRef_Func: func = {->123} + assert_equal(123, FuncRef_Func()) + let FuncRef_Any: any = {->123} + assert_equal(123, FuncRef_Any()) + END + CheckScriptSuccess(lines) enddef def Test_epxr7_funcref() |