Patch 8.2.2619
Problem: Vim9: no test for return type of lambda.
Solution: Add a test.
Files: src/testdir/test_vim9_func.vim
*** ../vim-8.2.2618/src/testdir/test_vim9_func.vim 2021-03-17
18:42:04.442869185 +0100
--- src/testdir/test_vim9_func.vim 2021-03-17 21:28:13.977666940 +0100
***************
*** 752,762 ****
--- 752,777 ----
CheckDefFailure(lines, 'E1167:')
enddef
+ def FilterWithCond(x: string, Cond: func(string): bool): bool
+ return Cond(x)
+ enddef
+
def Test_lambda_return_type()
var lines =<< trim END
var Ref = (): => 123
END
CheckDefAndScriptFailure(lines, 'E1157:', 1)
+
+ # this works
+ for x in ['foo', 'boo']
+ echo FilterWithCond(x, (v) => v =~ '^b')
+ endfor
+
+ # this fails
+ lines =<< trim END
+ echo FilterWithCond('foo', (v) => v .. '^b')
+ END
+ CheckDefAndScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected
func(string): bool but got func(any): string', 1)
enddef
def Test_lambda_uses_assigned_var()
*** ../vim-8.2.2618/src/version.c 2021-03-17 20:56:33.653085748 +0100
--- src/version.c 2021-03-17 21:28:51.769596088 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2619,
/**/
--
Engineers understand that their appearance only bothers other people and
therefore it is not worth optimizing.
(Scott Adams - The Dilbert principle)
/// 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/202103172030.12HKU0sl1091441%40masaka.moolenaar.net.