1
0
forked from aniani/vim

patch 8.2.1722: Vim9: cannot assign a lambda to a variable of type function

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)
This commit is contained in:
Bram Moolenaar
2020-09-21 21:48:21 +02:00
parent 7f9c9c51a3
commit dbd759309b
3 changed files with 19 additions and 1 deletions

View File

@@ -463,7 +463,11 @@ check_type(type_T *expected, type_T *actual, int give_msg, int argidx)
&& !(expected->tt_type == VAR_ANY && actual->tt_type != VAR_VOID))
{
if (expected->tt_type != actual->tt_type)
// tt_type should match, except that a "partial" can be assigned to a
// variable with type "func".
if (!(expected->tt_type == actual->tt_type
|| (expected->tt_type == VAR_FUNC
&& actual->tt_type == VAR_PARTIAL)))
{
if (expected->tt_type == VAR_BOOL
&& (actual->tt_flags & TTFLAG_BOOL_OK))