Skip to content

Commit 22f85d0

Browse files
committed
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)
1 parent 6977dba commit 22f85d0

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/testdir/test_vim9_assign.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,16 @@ def Test_assignment_partial()
681681
assert_equal('done', Partial())
682682
END
683683
CheckDefAndScriptSuccess(lines)
684+
685+
lines =<< trim END
686+
vim9script
687+
def Func(b: bool)
688+
enddef
689+
var Ref: func = function(Func, [true])
690+
assert_equal('func()', typename(Ref))
691+
Ref()
692+
END
693+
CheckScriptSuccess(lines)
684694
enddef
685695

686696
def Test_assignment_list_any_index()

src/userfunc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3148,7 +3148,8 @@ call_func(
31483148
argvars = argv;
31493149
argcount = partial->pt_argc + argcount_in;
31503150

3151-
if (funcexe->check_type != NULL)
3151+
if (funcexe->check_type != NULL
3152+
&& funcexe->check_type->tt_argcount != -1)
31523153
{
31533154
// Now funcexe->check_type is missing the added arguments, make
31543155
// a copy of the type with the correction.

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ static char *(features[]) =
755755

756756
static int included_patches[] =
757757
{ /* Add new patch number below this line */
758+
/**/
759+
3107,
758760
/**/
759761
3106,
760762
/**/

0 commit comments

Comments
 (0)