Problem: Confusing error if first argument of popup_create() is wrong.
Solution: Give a more informative error.
EXTERN char e_bitshift_ops_must_be_postive[]
INIT(= N_("E1283: Bitshift amount must be a positive number"));
#endif
+#if defined(FEAT_PROP_POPUP)
+EXTERN char e_argument_1_list_item_nr_dictionary_required[]
+ INIT(= N_("E1284: Argument 1, list item %d: Dictionary required"));
+#endif
{
if (li->li_tv.v_type != VAR_DICT)
{
- emsg(_(e_dictionary_required));
+ semsg(_(e_argument_1_list_item_nr_dictionary_required), lnum + 1);
return;
}
dict = li->li_tv.vval.v_dict;
if (l != NULL && l->lv_len > 0)
{
- if (l->lv_first->li_tv.v_type == VAR_STRING)
+ if (l->lv_first == &range_list_item)
+ emsg(_(e_using_number_as_string));
+ else if (l->lv_first->li_tv.v_type == VAR_STRING)
// list of strings
add_popup_strings(buf, l);
else
|~| @73
|~| @73
|~| @73
-|E+0#ffffff16#e000002|7|1|5|:| |D|i|c|t|i|o|n|a|r|y| |r|e|q|u|i|r|e|d| +0#0000000#ffffff0@31|0|,|0|-|1| @8|A|l@1|
+|E+0#ffffff16#e000002|1|0|2|4|:| |U|s|i|n|g| |a| |N|u|m|b|e|r| |a|s| |a| |S|t|r|i|n|g| +0#0000000#ffffff0@23|0|,|0|-|1| @8|A|l@1|
call assert_fails('call popup_create("text", #{borderchars: "none"})', 'E714:')
call popup_clear()
- call assert_fails('call popup_create([#{text: "text"}, 666], {})', 'E715:')
+ call assert_fails('call popup_create([#{text: "text"}, 666], {})', 'E1284: Argument 1, list item 2: Dictionary required')
call popup_clear()
call assert_fails('call popup_create([#{text: "text", props: "none"}], {})', 'E714:')
call popup_clear()
call popup_clear()
call assert_fails('call popup_create("text", #{tabpage : 4})', 'E997:')
call popup_clear()
+
+ call assert_fails('call popup_create(range(10), {})', 'E1024:')
+ call popup_clear()
+ call assert_fails('call popup_create([1, 2], {})', 'E1284: Argument 1, list item 1: Dictionary required')
+ call popup_clear()
endfunc
func Test_win_execute_closing_curwin()
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 5039,
/**/
5038,
/**/