patch 8.2.3107: Vim9: error for arguments while type didn't specify arguments
Problem: Vim9: error for arguments while type didn't specify arguments.
Solution: Do not update that type to check when no argument count is
specified. (closes #8492)
diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim
index a92a60b..6bbbc36 100644
--- a/src/testdir/test_vim9_assign.vim
+++ b/src/testdir/test_vim9_assign.vim
@@ -681,6 +681,16 @@
assert_equal('done', Partial())
END
CheckDefAndScriptSuccess(lines)
+
+ lines =<< trim END
+ vim9script
+ def Func(b: bool)
+ enddef
+ var Ref: func = function(Func, [true])
+ assert_equal('func()', typename(Ref))
+ Ref()
+ END
+ CheckScriptSuccess(lines)
enddef
def Test_assignment_list_any_index()
diff --git a/src/userfunc.c b/src/userfunc.c
index 404f85b..4234681 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -3148,7 +3148,8 @@
argvars = argv;
argcount = partial->pt_argc + argcount_in;
- if (funcexe->check_type != NULL)
+ if (funcexe->check_type != NULL
+ && funcexe->check_type->tt_argcount != -1)
{
// Now funcexe->check_type is missing the added arguments, make
// a copy of the type with the correction.
diff --git a/src/version.c b/src/version.c
index 10231ab..060c2e7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3107,
+/**/
3106,
/**/
3105,