mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.0.2055: Vim9: non-consistent error messages
Problem: Vim9: non-consistent error messages Solution: make error messages more consistent with common structure Adjust vim9class messages to follow common pattern. [Variable|Method] "var-or-meth-name" ... class "class-name" closes: #13391 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
This commit is contained in:
parent
ac709e2fc0
commit
d4802ec485
@ -3396,9 +3396,9 @@ EXTERN char e_using_class_as_string[]
|
|||||||
EXTERN char e_using_object_as_string[]
|
EXTERN char e_using_object_as_string[]
|
||||||
INIT(= N_("E1324: Using an object as a String"));
|
INIT(= N_("E1324: Using an object as a String"));
|
||||||
EXTERN char e_method_not_found_on_class_str_str[]
|
EXTERN char e_method_not_found_on_class_str_str[]
|
||||||
INIT(= N_("E1325: Method not found on class \"%s\": %s"));
|
INIT(= N_("E1325: Method \"%s\" not found in class \"%s\""));
|
||||||
EXTERN char e_variable_not_found_on_object_str_str[]
|
EXTERN char e_variable_not_found_on_object_str_str[]
|
||||||
INIT(= N_("E1326: Variable not found on object \"%s\": %s"));
|
INIT(= N_("E1326: Variable \"%s\" not found in object \"%s\""));
|
||||||
EXTERN char e_object_required_found_str[]
|
EXTERN char e_object_required_found_str[]
|
||||||
INIT(= N_("E1327: Object required, found %s"));
|
INIT(= N_("E1327: Object required, found %s"));
|
||||||
EXTERN char e_constructor_default_value_must_be_vnone_str[]
|
EXTERN char e_constructor_default_value_must_be_vnone_str[]
|
||||||
|
@ -132,7 +132,7 @@ def Test_class_basic()
|
|||||||
endclass
|
endclass
|
||||||
var obj = Something.new()
|
var obj = Something.new()
|
||||||
END
|
END
|
||||||
v9.CheckSourceFailure(lines, 'E1326: Variable not found on object "Something": state', 1)
|
v9.CheckSourceFailure(lines, 'E1326: Variable "state" not found in object "Something"', 1)
|
||||||
|
|
||||||
# Space before ":" in a member variable declaration
|
# Space before ":" in a member variable declaration
|
||||||
lines =<< trim END
|
lines =<< trim END
|
||||||
@ -648,7 +648,7 @@ def Test_member_any_used_as_object()
|
|||||||
var outer_obj = Outer.new(inner_obj)
|
var outer_obj = Outer.new(inner_obj)
|
||||||
F(outer_obj)
|
F(outer_obj)
|
||||||
END
|
END
|
||||||
v9.CheckSourceFailure(lines, 'E1326: Variable not found on object "Inner": someval', 1)
|
v9.CheckSourceFailure(lines, 'E1326: Variable "someval" not found in object "Inner"', 1)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
" Nested assignment to a object variable which is of another class type
|
" Nested assignment to a object variable which is of another class type
|
||||||
@ -1092,7 +1092,7 @@ def Test_instance_variable_access()
|
|||||||
trip.three = 33
|
trip.three = 33
|
||||||
assert_equal(33, trip.three)
|
assert_equal(33, trip.three)
|
||||||
|
|
||||||
assert_fails('trip.four = 4', 'E1326: Variable not found on object "Triple": four')
|
assert_fails('trip.four = 4', 'E1326: Variable "four" not found in object "Triple"')
|
||||||
END
|
END
|
||||||
v9.CheckSourceSuccess(lines)
|
v9.CheckSourceSuccess(lines)
|
||||||
|
|
||||||
@ -1743,7 +1743,7 @@ def Test_class_member()
|
|||||||
var a = A.new()
|
var a = A.new()
|
||||||
var v = a.bar
|
var v = a.bar
|
||||||
END
|
END
|
||||||
v9.CheckSourceFailure(lines, 'E1326: Variable not found on object "A": bar', 5)
|
v9.CheckSourceFailure(lines, 'E1326: Variable "bar" not found in object "A"', 5)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
" These messages should show the defining class of the variable (base class),
|
" These messages should show the defining class of the variable (base class),
|
||||||
@ -2080,7 +2080,7 @@ def Test_class_defcompile()
|
|||||||
var a = A.new()
|
var a = A.new()
|
||||||
defcompile a.Foo()
|
defcompile a.Foo()
|
||||||
END
|
END
|
||||||
v9.CheckSourceFailureList(lines, ['E1326: Variable not found on object "A": Foo', 'E475: Invalid argument: a.Foo()'])
|
v9.CheckSourceFailureList(lines, ['E1326: Variable "Foo" not found in object "A"', 'E475: Invalid argument: a.Foo()'])
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_class_object_to_string()
|
def Test_class_object_to_string()
|
||||||
@ -3055,7 +3055,7 @@ def Test_abstract_class()
|
|||||||
endclass
|
endclass
|
||||||
var p = Base.new('Peter')
|
var p = Base.new('Peter')
|
||||||
END
|
END
|
||||||
v9.CheckSourceFailure(lines, 'E1325: Method not found on class "Base": new', 8)
|
v9.CheckSourceFailure(lines, 'E1325: Method "new" not found in class "Base"', 8)
|
||||||
|
|
||||||
lines =<< trim END
|
lines =<< trim END
|
||||||
abstract class Base
|
abstract class Base
|
||||||
@ -4478,7 +4478,7 @@ def Test_lockvar_islocked_notfound()
|
|||||||
var obj = C.new()
|
var obj = C.new()
|
||||||
obj.Islocked("this.notobjmember")
|
obj.Islocked("this.notobjmember")
|
||||||
END
|
END
|
||||||
v9.CheckSourceFailure(lines, 'E1326: Variable not found on object "C": notobjmember')
|
v9.CheckSourceFailure(lines, 'E1326: Variable "notobjmember" not found in object "C"')
|
||||||
|
|
||||||
# access a script variable through methods
|
# access a script variable through methods
|
||||||
lines =<< trim END
|
lines =<< trim END
|
||||||
@ -4938,7 +4938,7 @@ def Test_private_class_method()
|
|||||||
var c = C.new()
|
var c = C.new()
|
||||||
assert_equal(1234, C._Foo())
|
assert_equal(1234, C._Foo())
|
||||||
END
|
END
|
||||||
v9.CheckSourceFailure(lines, 'E1325: Method not found on class "C": _Foo', 16)
|
v9.CheckSourceFailure(lines, 'E1325: Method "_Foo" not found in class "C"', 16)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
" Test for using the return value of a class/object method as a function
|
" Test for using the return value of a class/object method as a function
|
||||||
@ -5227,7 +5227,7 @@ def Test_private_member_access_outside_class()
|
|||||||
enddef
|
enddef
|
||||||
T()
|
T()
|
||||||
END
|
END
|
||||||
v9.CheckSourceFailure(lines, 'E1326: Variable not found on object "A": _a', 2)
|
v9.CheckSourceFailure(lines, 'E1326: Variable "_a" not found in object "A"', 2)
|
||||||
|
|
||||||
# private static member variable
|
# private static member variable
|
||||||
lines =<< trim END
|
lines =<< trim END
|
||||||
|
@ -704,6 +704,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 */
|
||||||
|
/**/
|
||||||
|
2055,
|
||||||
/**/
|
/**/
|
||||||
2054,
|
2054,
|
||||||
/**/
|
/**/
|
||||||
|
@ -2974,8 +2974,8 @@ method_not_found_msg(class_T *cl, vartype_T v_type, char_u *name, size_t len)
|
|||||||
method_name, cl->class_name);
|
method_name, cl->class_name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
semsg(_(e_method_not_found_on_class_str_str), cl->class_name,
|
semsg(_(e_method_not_found_on_class_str_str), method_name,
|
||||||
method_name);
|
cl->class_name);
|
||||||
vim_free(method_name);
|
vim_free(method_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2993,8 +2993,8 @@ member_not_found_msg(class_T *cl, vartype_T v_type, char_u *name, size_t len)
|
|||||||
semsg(_(e_class_variable_str_accessible_only_using_class_str),
|
semsg(_(e_class_variable_str_accessible_only_using_class_str),
|
||||||
varname, cl->class_name);
|
varname, cl->class_name);
|
||||||
else
|
else
|
||||||
semsg(_(e_variable_not_found_on_object_str_str), cl->class_name,
|
semsg(_(e_variable_not_found_on_object_str_str), varname,
|
||||||
varname);
|
cl->class_name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user