To: vim_dev@googlegroups.com Subject: Patch 8.2.3230 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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 -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///