Patch 8.2.2283
Problem: Vim9: crash when lambda has fewer arguments than expected.
Solution: Don't check arguments when already failed. (closes #7606)
Files: src/vim9type.c, src/testdir/test_vim9_func.vim
*** ../vim-8.2.2282/src/vim9type.c 2020-12-31 13:31:20.517508010 +0100
--- src/vim9type.c 2021-01-03 13:03:49.243801075 +0100
***************
*** 490,497 ****
&& actual->tt_argcount != -1
&& (actual->tt_argcount < expected->tt_min_argcount
|| actual->tt_argcount > expected->tt_argcount))
! ret = FAIL;
! if (expected->tt_args != NULL && actual->tt_args != NULL)
{
int i;
--- 490,498 ----
&& actual->tt_argcount != -1
&& (actual->tt_argcount < expected->tt_min_argcount
|| actual->tt_argcount > expected->tt_argcount))
! ret = FAIL;
! if (ret == OK && expected->tt_args != NULL
! && actual->tt_args != NULL)
{
int i;
*** ../vim-8.2.2282/src/testdir/test_vim9_func.vim 2021-01-01
18:54:31.034916407 +0100
--- src/testdir/test_vim9_func.vim 2021-01-03 13:09:15.850519558 +0100
***************
*** 554,559 ****
--- 554,571 ----
echo Ref(1, 'x')
END
CheckDefFailure(lines, 'E1013: Argument 2: type mismatch, expected number
but got string')
+
+ lines =<< trim END
+ var Ref: func(job, string, number)
+ Ref = (x, y) => 0
+ END
+ CheckDefAndScriptFailure(lines, 'E1012:')
+
+ lines =<< trim END
+ var Ref: func(job, string)
+ Ref = (x, y, z) => 0
+ END
+ CheckDefAndScriptFailure(lines, 'E1012:')
enddef
def Test_lambda_uses_assigned_var()
*** ../vim-8.2.2282/src/version.c 2021-01-02 20:14:20.143734625 +0100
--- src/version.c 2021-01-03 13:09:38.590429006 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2283,
/**/
--
Warning label on a superhero Halloween costume:
"Caution: Cape does not enable user to fly."
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202101031211.103CB55p2106636%40masaka.moolenaar.net.