summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/testdir/test_lambda.vim6
-rw-r--r--src/userfunc.c12
-rw-r--r--src/version.c2
3 files changed, 18 insertions, 2 deletions
diff --git a/src/testdir/test_lambda.vim b/src/testdir/test_lambda.vim
index 901d535e8..a95d591ce 100644
--- a/src/testdir/test_lambda.vim
+++ b/src/testdir/test_lambda.vim
@@ -284,3 +284,9 @@ func Test_named_function_closure()
call test_garbagecollect_now()
call assert_equal(14, s:Abar())
endfunc
+
+func Test_lambda_with_index()
+ let List = {x -> [x]}
+ let Extract = {-> function(List, ['foobar'])()[0]}
+ call assert_equal('foobar', Extract())
+endfunc
diff --git a/src/userfunc.c b/src/userfunc.c
index f9b0e8192..08112689d 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1349,8 +1349,16 @@ call_func(
}
- /* execute the function if no errors detected and executing */
- if (evaluate && error == ERROR_NONE)
+ /*
+ * Execute the function if executing and no errors were detected.
+ */
+ if (!evaluate)
+ {
+ // Not evaluating, which means the return value is unknown. This
+ // matters for giving error messages.
+ rettv->v_type = VAR_UNKNOWN;
+ }
+ else if (error == ERROR_NONE)
{
char_u *rfname = fname;
diff --git a/src/version.c b/src/version.c
index 1f8cfefb0..b629933ff 100644
--- a/src/version.c
+++ b/src/version.c
@@ -762,6 +762,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 19,
+/**/
18,
/**/
17,