Patch 8.2.3230
Problem: Vim9: type error when function return type is not known yet.
Solution: When return type is unknown, use "any". (closes #8644)
Files: src/vim9compile.c, src/testdir/test_vim9_builtin.vim
*** ../vim-8.2.3229/src/vim9compile.c 2021-07-26 21:10:07.977693943 +0200
--- src/vim9compile.c 2021-07-27 22:20:09.839202236 +0200
***************
*** 2130,2135 ****
--- 2130,2138 ----
}
}
ret_type = type->tt_member;
+ if (ret_type == &t_unknown)
+ // return type not known yet, use a runtime check
+ ret_type = &t_any;
}
else
{
*** ../vim-8.2.3229/src/testdir/test_vim9_builtin.vim 2021-07-27
22:00:39.753712380 +0200
--- src/testdir/test_vim9_builtin.vim 2021-07-27 22:19:26.855270283 +0200
***************
*** 1172,1177 ****
--- 1172,1187 ----
var F: func = function('min', [[5, 8, 6]])
F->get('name')->assert_equal('min')
F->get('args')->assert_equal([[5, 8, 6]])
+
+ var lines =<< trim END
+ vim9script
+ def DoThat(): number
+ var Getqflist: func = function('getqflist', [{id: 42}])
+ return Getqflist()->get('id', 77)
+ enddef
+ assert_equal(0, DoThat())
+ END
+ CheckScriptSuccess(lines)
enddef
def Test_getbufinfo()
*** ../vim-8.2.3229/src/version.c 2021-07-27 22:00:39.757712371 +0200
--- src/version.c 2021-07-27 22:15:50.319622970 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3230,
/**/
--
hundred-and-one symptoms of being an internet addict:
253. You wait for a slow loading web page before going to the toilet.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ 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/202107272022.16RKMQYC1687841%40masaka.moolenaar.net.