Patch 8.2.3154
Problem: Vim9: some type checks for builtin functions fail.
Solution: Correct the type checks. (Yegappan Lakshmanan, closes #8551,
closes #8550)
Files: src/evalfunc.c, src/testdir/test_vim9_builtin.vim
*** ../vim-8.2.3153/src/evalfunc.c 2021-07-11 19:44:14.114416536 +0200
--- src/evalfunc.c 2021-07-11 22:02:29.755963854 +0200
***************
*** 431,439 ****
static int
arg_str_or_nr_or_list(type_T *type, argcontext_T *context)
{
! if (type->tt_type == VAR_STRING
! || type->tt_type == VAR_NUMBER
! || type->tt_type == VAR_LIST)
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
--- 431,440 ----
static int
arg_str_or_nr_or_list(type_T *type, argcontext_T *context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_STRING
! || type->tt_type == VAR_NUMBER
! || type->tt_type == VAR_LIST)
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
*** ../vim-8.2.3153/src/testdir/test_vim9_builtin.vim 2021-07-11
19:44:14.114416536 +0200
--- src/testdir/test_vim9_builtin.vim 2021-07-11 22:02:29.755963854 +0200
***************
*** 1523,1528 ****
--- 1523,1534 ----
def Test_popup_atcursor()
CheckDefAndScriptFailure2(['popup_atcursor({"a": 10}, {})'], 'E1013:
Argument 1: type mismatch, expected string but got dict<number>', 'E450: buffer
number, text or a list required')
CheckDefAndScriptFailure2(['popup_atcursor("a", [1, 2])'], 'E1013: Argument
2: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary
required')
+
+ # Pass variable of type 'any' to popup_atcursor()
+ var what: any = 'Hello'
+ var popupID = what->popup_atcursor({moved: 'any'})
+ assert_equal(0, popupID->popup_getoptions().tabpage)
+ popupID->popup_close()
enddef
def Test_popup_beval()
***************
*** 1530,1535 ****
--- 1536,1549 ----
CheckDefAndScriptFailure2(['popup_beval("a", [1, 2])'], 'E1013: Argument 2:
type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary
required')
enddef
+ def Test_popup_create()
+ # Pass variable of type 'any' to popup_create()
+ var what: any = 'Hello'
+ var popupID = what->popup_create({})
+ assert_equal(0, popupID->popup_getoptions().tabpage)
+ popupID->popup_close()
+ enddef
+
def Test_popup_dialog()
CheckDefAndScriptFailure2(['popup_dialog({"a": 10}, {})'], 'E1013: Argument
1: type mismatch, expected string but got dict<number>', 'E450: buffer number,
text or a list required')
CheckDefAndScriptFailure2(['popup_dialog("a", [1, 2])'], 'E1013: Argument
2: type mismatch, expected dict<any> but got list<number>', 'E715: Dictionary
required')
***************
*** 2358,2363 ****
--- 2372,2378 ----
setline(1, ['abcdefgh'])
cursor(1, 4)
assert_equal(4, virtcol('.'))
+ assert_equal(4, virtcol([1, 4]))
assert_equal(9, virtcol([1, '$']))
assert_equal(0, virtcol([10, '$']))
bw!
*** ../vim-8.2.3153/src/version.c 2021-07-11 21:51:13.417271076 +0200
--- src/version.c 2021-07-11 22:04:05.947781942 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3154,
/**/
--
hundred-and-one symptoms of being an internet addict:
123. You ask the car dealer to install an extra cigarette lighter
on your new car to power your notebook.
/// 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/202107112004.16BK4qCX908532%40masaka.moolenaar.net.