To: vim_dev@googlegroups.com Subject: Patch 8.2.3404 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3404 Problem: Vim9: no error for white space before "(". Solution: Give an error, like in a compiled function. Files: src/userfunc.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.3403/src/userfunc.c 2021-08-28 15:56:03.461179888 +0200 --- src/userfunc.c 2021-09-05 16:29:39.056668483 +0200 *************** *** 4921,4933 **** // Skip white space to allow ":call func ()". Not good, but required for // backward compatibility. startarg = skipwhite(arg); - rettv.v_type = VAR_UNKNOWN; // clear_tv() uses this - if (*startarg != '(') { semsg(_(e_missing_paren), eap->arg); goto end; } /* * When skipping, evaluate the function once, to find the end of the --- 4921,4936 ---- // Skip white space to allow ":call func ()". Not good, but required for // backward compatibility. startarg = skipwhite(arg); if (*startarg != '(') { semsg(_(e_missing_paren), eap->arg); goto end; } + if (in_vim9script() && startarg > arg) + { + semsg(_(e_no_white_space_allowed_before_str_str), "(", eap->arg); + goto end; + } /* * When skipping, evaluate the function once, to find the end of the *************** *** 4969,4974 **** --- 4972,4978 ---- funcexe.partial = partial; funcexe.selfdict = fudi.fd_dict; funcexe.check_type = type; + rettv.v_type = VAR_UNKNOWN; // clear_tv() uses this if (get_func_tv(name, -1, &rettv, &arg, &evalarg, &funcexe) == FAIL) { failed = TRUE; *** ../vim-8.2.3403/src/testdir/test_vim9_func.vim 2021-08-19 21:08:26.178565751 +0200 --- src/testdir/test_vim9_func.vim 2021-09-05 16:35:12.603822749 +0200 *************** *** 467,472 **** --- 467,476 ---- MyVarargs('one', 'two', 'three')->assert_equal('one,two,three') enddef + def Test_call_white_space() + CheckDefAndScriptFailure2(["call Test ('text')"], 'E476:', 'E1068:') + enddef + def MyDefaultArgs(name = 'string'): string return name enddef *** ../vim-8.2.3403/src/version.c 2021-09-04 21:20:37.895881447 +0200 --- src/version.c 2021-09-05 16:32:22.820257344 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3404, /**/ -- No engineer can take a shower without wondering if some sort of Teflon coating would make showering unnecessary. (Scott Adams - The Dilbert principle) /// 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 ///