To: vim_dev@googlegroups.com Subject: Patch 8.2.2583 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2583 Problem: Vim9: cannot compare result of getenv() with null. Solution: Make the return type of getenv() "any". (closes #7943) Files: src/evalfunc.c, src/testdir/test_vim9_builtin.vim *** ../vim-8.2.2582/src/evalfunc.c 2021-02-15 20:37:58.453374547 +0100 --- src/evalfunc.c 2021-03-10 16:07:27.961891147 +0100 *************** *** 1021,1027 **** {"getcwd", 0, 2, FEARG_1, NULL, ret_string, f_getcwd}, {"getenv", 1, 1, FEARG_1, NULL, ! ret_string, f_getenv}, {"getfontname", 0, 1, 0, NULL, ret_string, f_getfontname}, {"getfperm", 1, 1, FEARG_1, NULL, --- 1021,1027 ---- {"getcwd", 0, 2, FEARG_1, NULL, ret_string, f_getcwd}, {"getenv", 1, 1, FEARG_1, NULL, ! ret_any, f_getenv}, {"getfontname", 0, 1, 0, NULL, ret_string, f_getfontname}, {"getfperm", 1, 1, FEARG_1, NULL, *** ../vim-8.2.2582/src/testdir/test_vim9_builtin.vim 2021-02-21 16:20:14.252629218 +0100 --- src/testdir/test_vim9_builtin.vim 2021-03-10 16:07:06.321945375 +0100 *************** *** 472,477 **** --- 472,490 ---- getchar(true)->assert_equal(0) enddef + def Test_getenv() + if getenv('does-not_exist') == '' + assert_report('getenv() should return null') + endif + if getenv('does-not_exist') == null + else + assert_report('getenv() should return null') + endif + $SOMEENVVAR = 'some' + assert_equal('some', getenv('SOMEENVVAR')) + unlet $SOMEENVVAR + enddef + def Test_getcompletion() set wildignore=*.vim,*~ var l = getcompletion('run', 'file', true) *** ../vim-8.2.2582/src/version.c 2021-03-10 14:00:15.571489906 +0100 --- src/version.c 2021-03-10 16:03:01.438560443 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2583, /**/ -- Friends? I have lots of friends! In fact, I have all episodes ever made. /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///