mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.2528: Vim9: crash when compiling lambda fails
Problem: Vim9: crash when compiling lambda fails. Solution: Bail out after compilation fails. (closes #7862)
This commit is contained in:
@@ -3428,8 +3428,12 @@ eval7(
|
|||||||
ufunc_T *ufunc = rettv->vval.v_partial->pt_func;
|
ufunc_T *ufunc = rettv->vval.v_partial->pt_func;
|
||||||
|
|
||||||
// compile it here to get the return type
|
// compile it here to get the return type
|
||||||
compile_def_function(ufunc,
|
if (compile_def_function(ufunc,
|
||||||
TRUE, PROFILING(ufunc), NULL);
|
TRUE, PROFILING(ufunc), NULL) == FAIL)
|
||||||
|
{
|
||||||
|
clear_tv(rettv);
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ret == NOTDONE)
|
if (ret == NOTDONE)
|
||||||
|
@@ -1118,6 +1118,11 @@ def Test_assign_lambda()
|
|||||||
Ref = (j) => !j
|
Ref = (j) => !j
|
||||||
END
|
END
|
||||||
CheckDefAndScriptFailure(lines, 'E1012: Type mismatch; expected func(number) but got func(any): bool')
|
CheckDefAndScriptFailure(lines, 'E1012: Type mismatch; expected func(number) but got func(any): bool')
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
echo filter([1, 2, 3], (_, v: string) => v + 1)
|
||||||
|
END
|
||||||
|
CheckDefAndScriptFailure(lines, 'E1051:')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_heredoc()
|
def Test_heredoc()
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2528,
|
||||||
/**/
|
/**/
|
||||||
2527,
|
2527,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user