mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.3359: Vim9: error for type when variable is not set
Problem: Vim9: error for type when variable is not set. Solution: Give a specific error for a NULL function. (closes #8773)
This commit is contained in:
parent
dea561111a
commit
c66f645b80
@ -652,3 +652,5 @@ EXTERN char e_exists_compiled_can_only_be_used_in_def_function[]
|
|||||||
INIT(= N_("E1233: exists_compiled() can only be used in a :def function"));
|
INIT(= N_("E1233: exists_compiled() can only be used in a :def function"));
|
||||||
EXTERN char e_legacy_must_be_followed_by_command[]
|
EXTERN char e_legacy_must_be_followed_by_command[]
|
||||||
INIT(= N_("E1234: legacy must be followed by a command"));
|
INIT(= N_("E1234: legacy must be followed by a command"));
|
||||||
|
EXTERN char e_function_reference_is_not_set[]
|
||||||
|
INIT(= N_("E1235: Function reference is not set"));
|
||||||
|
@ -2696,6 +2696,15 @@ def Test_partial_call()
|
|||||||
assert_equal('ooooo', RepeatFunc(5))
|
assert_equal('ooooo', RepeatFunc(5))
|
||||||
END
|
END
|
||||||
CheckDefAndScriptSuccess(lines)
|
CheckDefAndScriptSuccess(lines)
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
def Foo(Parser: any)
|
||||||
|
enddef
|
||||||
|
var Expr: func(dict<any>): dict<any>
|
||||||
|
const Call = Foo(Expr)
|
||||||
|
END
|
||||||
|
CheckScriptFailure(lines, 'E1235:')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_cmd_modifier()
|
def Test_cmd_modifier()
|
||||||
|
@ -755,6 +755,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3359,
|
||||||
/**/
|
/**/
|
||||||
3358,
|
3358,
|
||||||
/**/
|
/**/
|
||||||
|
@ -461,6 +461,16 @@ check_typval_type(type_T *expected, typval_T *actual_tv, where_T where)
|
|||||||
type_T *actual_type;
|
type_T *actual_type;
|
||||||
int res = FAIL;
|
int res = FAIL;
|
||||||
|
|
||||||
|
// For some values there is no type, assume an error will be given later
|
||||||
|
// for an invalid value.
|
||||||
|
if ((actual_tv->v_type == VAR_FUNC && actual_tv->vval.v_string == NULL)
|
||||||
|
|| (actual_tv->v_type == VAR_PARTIAL
|
||||||
|
&& actual_tv->vval.v_partial == NULL))
|
||||||
|
{
|
||||||
|
emsg(_(e_function_reference_is_not_set));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
ga_init2(&type_list, sizeof(type_T *), 10);
|
ga_init2(&type_list, sizeof(type_T *), 10);
|
||||||
actual_type = typval2type(actual_tv, get_copyID(), &type_list, TRUE);
|
actual_type = typval2type(actual_tv, get_copyID(), &type_list, TRUE);
|
||||||
if (actual_type != NULL)
|
if (actual_type != NULL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user