0
0
mirror of https://github.com/vim/vim.git synced 2025-08-31 20:53:42 -04:00

patch 9.0.1935: Vim9: not consistent error messages

Problem:  Vim9: not consistent error messages
Solution: Make error messages more consistent. Use "variable" for
          (object/class) member

closes: #13155

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: RestorerZ <restorer@mail2k.ru>
This commit is contained in:
RestorerZ 2023-09-24 23:21:24 +02:00 committed by Christian Brabandt
parent 46bdae036a
commit 7fe8f43f49
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
9 changed files with 136 additions and 128 deletions

View File

@ -3376,8 +3376,8 @@ EXTERN char e_white_space_required_after_name_str[]
INIT(= N_("E1315: White space required after name: %s"));
EXTERN char e_class_can_only_be_defined_in_vim9_script[]
INIT(= N_("E1316: Class can only be defined in Vim9 script"));
EXTERN char e_invalid_object_member_declaration_str[]
INIT(= N_("E1317: Invalid object member declaration: %s"));
EXTERN char e_invalid_object_variable_declaration_str[]
INIT(= N_("E1317: Invalid object variable declaration: %s"));
EXTERN char e_not_valid_command_in_class_str[]
INIT(= N_("E1318: Not a valid command in a class: %s"));
EXTERN char e_using_class_as_number[]
@ -3394,30 +3394,30 @@ EXTERN char e_using_object_as_string[]
INIT(= N_("E1324: Using an object as a String"));
EXTERN char e_method_not_found_on_class_str_str[]
INIT(= N_("E1325: Method not found on class \"%s\": %s"));
EXTERN char e_member_not_found_on_object_str_str[]
INIT(= N_("E1326: Member not found on object \"%s\": %s"));
EXTERN char e_variable_not_found_on_object_str_str[]
INIT(= N_("E1326: Variable not found on object \"%s\": %s"));
EXTERN char e_object_required_found_str[]
INIT(= N_("E1327: Object required, found %s"));
EXTERN char e_constructor_default_value_must_be_vnone_str[]
INIT(= N_("E1328: Constructor default value must be v:none: %s"));
// E1329 unused
EXTERN char e_invalid_type_for_object_member_str[]
INIT(= N_("E1330: Invalid type for object member: %s"));
EXTERN char e_invalid_type_for_object_variable_str[]
INIT(= N_("E1330: Invalid type for object variable: %s"));
EXTERN char e_public_must_be_followed_by_this_or_static[]
INIT(= N_("E1331: Public must be followed by \"this\" or \"static\""));
EXTERN char e_public_member_name_cannot_start_with_underscore_str[]
INIT(= N_("E1332: Public member name cannot start with underscore: %s"));
EXTERN char e_cannot_access_private_member_str[]
INIT(= N_("E1333: Cannot access private member: %s"));
EXTERN char e_public_variable_name_cannot_start_with_underscore_str[]
INIT(= N_("E1332: Public variable name cannot start with underscore: %s"));
EXTERN char e_cannot_access_private_variable_str[]
INIT(= N_("E1333: Cannot access private variable: %s"));
// E1334 unused
EXTERN char e_member_is_not_writable_str[]
EXTERN char e_variable_is_not_writable_str[]
INIT(= N_("E1335: Variable \"%s\" in class \"%s\" is not writable"));
#endif
EXTERN char e_internal_error_shortmess_too_long[]
INIT(= "E1336: Internal error: shortmess too long");
#ifdef FEAT_EVAL
EXTERN char e_class_member_str_not_found_in_class_str[]
INIT(= N_("E1337: Class member \"%s\" not found in class \"%s\""));
EXTERN char e_class_variable_str_not_found_in_class_str[]
INIT(= N_("E1337: Class variable \"%s\" not found in class \"%s\""));
// E1338 unused
#endif
#ifdef FEAT_PROP_POPUP
@ -3433,16 +3433,16 @@ EXTERN char e_interface_can_only_be_defined_in_vim9_script[]
INIT(= N_("E1342: Interface can only be defined in Vim9 script"));
EXTERN char e_interface_name_must_start_with_uppercase_letter_str[]
INIT(= N_("E1343: Interface name must start with an uppercase letter: %s"));
EXTERN char e_cannot_initialize_member_in_interface[]
INIT(= N_("E1344: Cannot initialize a member in an interface"));
EXTERN char e_cannot_initialize_variable_in_interface[]
INIT(= N_("E1344: Cannot initialize a variable in an interface"));
EXTERN char e_not_valid_command_in_interface_str[]
INIT(= N_("E1345: Not a valid command in an interface: %s"));
EXTERN char e_interface_name_not_found_str[]
INIT(= N_("E1346: Interface name not found: %s"));
EXTERN char e_not_valid_interface_str[]
INIT(= N_("E1347: Not a valid interface: %s"));
EXTERN char e_member_str_of_interface_str_not_implemented[]
INIT(= N_("E1348: Member \"%s\" of interface \"%s\" is not implemented"));
EXTERN char e_variable_str_of_interface_str_not_implemented[]
INIT(= N_("E1348: Variable \"%s\" of interface \"%s\" is not implemented"));
EXTERN char e_method_str_of_interface_str_not_implemented[]
INIT(= N_("E1349: Method \"%s\" of interface \"%s\" is not implemented"));
EXTERN char e_duplicate_implements[]
@ -3459,12 +3459,12 @@ EXTERN char e_duplicate_function_str[]
INIT(= N_("E1355: Duplicate function: %s"));
EXTERN char e_super_must_be_followed_by_dot[]
INIT(= N_("E1356: \"super\" must be followed by a dot"));
EXTERN char e_using_super_not_in_class_function[]
INIT(= N_("E1357: Using \"super\" not in a class function"));
EXTERN char e_using_super_not_in_class_method[]
INIT(= N_("E1357: Using \"super\" not in a class method"));
EXTERN char e_using_super_not_in_child_class[]
INIT(= N_("E1358: Using \"super\" not in a child class"));
EXTERN char e_cannot_define_new_function_in_abstract_class[]
INIT(= N_("E1359: Cannot define a \"new\" function in an abstract class"));
EXTERN char e_cannot_define_new_method_in_abstract_class[]
INIT(= N_("E1359: Cannot define a \"new\" method in an abstract class"));
EXTERN char e_using_null_object[]
INIT(= N_("E1360: Using a null object"));
#endif
@ -3479,30 +3479,30 @@ EXTERN char e_incomplete_type[]
EXTERN char e_warning_pointer_block_corrupted[]
INIT(= N_("E1364: Warning: Pointer block corrupted"));
#ifdef FEAT_EVAL
EXTERN char e_cannot_use_a_return_type_with_new[]
INIT(= N_("E1365: Cannot use a return type with the \"new\" function"));
EXTERN char e_cannot_use_a_return_type_with_new_method[]
INIT(= N_("E1365: Cannot use a return type with the \"new\" method"));
EXTERN char e_cannot_access_private_method_str[]
INIT(= N_("E1366: Cannot access private method: %s"));
EXTERN char e_member_str_of_interface_str_has_different_access[]
INIT(= N_("E1367: Access level of member \"%s\" of interface \"%s\" is different"));
EXTERN char e_variable_str_of_interface_str_has_different_access[]
INIT(= N_("E1367: Access level of variable \"%s\" of interface \"%s\" is different"));
EXTERN char e_static_cannot_be_followed_by_this[]
INIT(= N_("E1368: Static cannot be followed by \"this\" in a member name"));
EXTERN char e_duplicate_member_str[]
INIT(= N_("E1369: Duplicate member: %s"));
EXTERN char e_cannot_define_new_function_as_static[]
INIT(= N_("E1370: Cannot define a \"new\" function as static"));
INIT(= N_("E1368: Static cannot be followed by \"this\" in a variable name"));
EXTERN char e_duplicate_variable_str[]
INIT(= N_("E1369: Duplicate variable: %s"));
EXTERN char e_cannot_define_new_method_as_static[]
INIT(= N_("E1370: Cannot define a \"new\" method as static"));
EXTERN char e_abstract_must_be_followed_by_def_or_static[]
INIT(= N_("E1371: Abstract must be followed by \"def\" or \"static\""));
EXTERN char e_abstract_method_in_concrete_class[]
INIT(= N_("E1372: Abstract method \"%s\" cannot be defined in a concrete class"));
EXTERN char e_abstract_method_str_not_found[]
INIT(= N_("E1373: Abstract method \"%s\" is not implemented"));
EXTERN char e_class_member_str_accessible_only_inside_class_str[]
INIT(= N_("E1374: Class member \"%s\" accessible only inside class \"%s\""));
EXTERN char e_class_member_str_accessible_only_using_class_str[]
INIT(= N_("E1375: Class member \"%s\" accessible only using class \"%s\""));
EXTERN char e_object_member_str_accessible_only_using_object_str[]
INIT(= N_("E1376: Object member \"%s\" accessible only using class \"%s\" object"));
EXTERN char e_class_variable_str_accessible_only_inside_class_str[]
INIT(= N_("E1374: Class variable \"%s\" accessible only inside class \"%s\""));
EXTERN char e_class_variable_str_accessible_only_using_class_str[]
INIT(= N_("E1375: Class variable \"%s\" accessible only using class \"%s\""));
EXTERN char e_object_variable_str_accessible_only_using_object_str[]
INIT(= N_("E1376: Object variable \"%s\" accessible only using class \"%s\" object"));
EXTERN char e_method_str_of_class_str_has_different_access[]
INIT(= N_("E1377: Access level of method \"%s\" is different in class \"%s\""));
EXTERN char e_static_member_not_supported_in_interface[]
@ -3513,10 +3513,16 @@ EXTERN char e_private_method_not_supported_in_interface[]
INIT(= N_("E1380: Private method not supported in an interface"));
EXTERN char e_interface_cannot_use_implements[]
INIT(= N_("E1381: Interface cannot use \"implements\""));
EXTERN char e_member_str_type_mismatch_expected_str_but_got_str[]
INIT(= N_("E1382: Member \"%s\": type mismatch, expected %s but got %s"));
EXTERN char e_variable_str_type_mismatch_expected_str_but_got_str[]
INIT(= N_("E1382: Variable \"%s\": type mismatch, expected %s but got %s"));
EXTERN char e_method_str_type_mismatch_expected_str_but_got_str[]
INIT(= N_("E1383: Method \"%s\": type mismatch, expected %s but got %s"));
EXTERN char e_class_method_str_accessible_only_inside_class_str[]
INIT(= N_("E1384: Class method \"%s\" accessible only inside class \"%s\""));
EXTERN char e_class_method_str_accessible_only_using_class_str[]
INIT(= N_("E1385: Class method \"%s\" accessible only using class \"%s\""));
EXTERN char e_object_method_str_accessible_only_using_object_str[]
INIT(= N_("E1386: Object method \"%s\" accessible only using class \"%s\" object"));
#endif
EXTERN char e_cannot_mix_positional_and_non_positional_str[]
INIT(= N_("E1400: Cannot mix positional and non-positional arguments: %s"));
@ -3532,4 +3538,4 @@ EXTERN char e_invalid_format_specifier_str[]
INIT(= N_("E1405: Invalid format specifier: %s"));
EXTERN char e_aptypes_is_null_nr_str[]
INIT(= "E1408: Internal error: ap_types or ap_types[idx] is NULL: %d: %s");
// E1384 - E1399 unused
// E1387 - E1399 unused

View File

@ -1560,7 +1560,7 @@ get_lval(
switch (om->ocm_access)
{
case VIM_ACCESS_PRIVATE:
semsg(_(e_cannot_access_private_member_str),
semsg(_(e_cannot_access_private_variable_str),
om->ocm_name);
return NULL;
case VIM_ACCESS_READ:
@ -1569,7 +1569,7 @@ get_lval(
break;
if ((flags & GLV_READ_ONLY) == 0)
{
semsg(_(e_member_is_not_writable_str),
semsg(_(e_variable_is_not_writable_str),
om->ocm_name, cl->class_name);
return NULL;
}

View File

@ -132,7 +132,7 @@ def Test_class_basic()
endclass
var obj = Something.new()
END
v9.CheckSourceFailure(lines, 'E1326: Member not found on object "Something": state')
v9.CheckSourceFailure(lines, 'E1326: Variable not found on object "Something": state')
# Space before ":" in a member variable declaration
lines =<< trim END
@ -563,7 +563,7 @@ def Test_member_any_used_as_object()
var outer_obj = Outer.new(inner_obj)
F(outer_obj)
END
v9.CheckSourceFailure(lines, 'E1333: Cannot access private member: _value')
v9.CheckSourceFailure(lines, 'E1333: Cannot access private variable: _value')
# Try modifying a non-existing variable using an "any" object
lines =<< trim END
@ -585,7 +585,7 @@ def Test_member_any_used_as_object()
var outer_obj = Outer.new(inner_obj)
F(outer_obj)
END
v9.CheckSourceFailure(lines, 'E1326: Member not found on object "Inner": someval')
v9.CheckSourceFailure(lines, 'E1326: Variable not found on object "Inner": someval')
enddef
" Nested assignment to a object variable which is of another class type
@ -1009,7 +1009,7 @@ def Test_class_object_member_inits()
this.value: void
endclass
END
v9.CheckSourceFailure(lines, 'E1330: Invalid type for object member: void')
v9.CheckSourceFailure(lines, 'E1330: Invalid type for object variable: void')
enddef
" Test for instance variable access
@ -1154,7 +1154,7 @@ def Test_instance_variable_access()
endclass
A.val = 1
END
v9.CheckSourceFailure(lines, 'E1376: Object member "val" accessible only using class "A" object')
v9.CheckSourceFailure(lines, 'E1376: Object variable "val" accessible only using class "A" object')
# Read a instance variable using the class name in the script context
lines =<< trim END
@ -1164,7 +1164,7 @@ def Test_instance_variable_access()
endclass
var i = A.val
END
v9.CheckSourceFailure(lines, 'E1376: Object member "val" accessible only using class "A" object')
v9.CheckSourceFailure(lines, 'E1376: Object variable "val" accessible only using class "A" object')
# Modify a instance variable using the class name in a def function
lines =<< trim END
@ -1177,7 +1177,7 @@ def Test_instance_variable_access()
enddef
T()
END
v9.CheckSourceFailure(lines, 'E1376: Object member "val" accessible only using class "A" object')
v9.CheckSourceFailure(lines, 'E1376: Object variable "val" accessible only using class "A" object')
# Read a instance variable using the class name in a def function
lines =<< trim END
@ -1190,7 +1190,7 @@ def Test_instance_variable_access()
enddef
T()
END
v9.CheckSourceFailure(lines, 'E1376: Object member "val" accessible only using class "A" object')
v9.CheckSourceFailure(lines, 'E1376: Object variable "val" accessible only using class "A" object')
# Access from child class extending a class:
lines =<< trim END
@ -1237,7 +1237,7 @@ def Test_class_variable_access()
static this.val = 1
endclass
END
v9.CheckSourceFailure(lines, 'E1368: Static cannot be followed by "this" in a member name')
v9.CheckSourceFailure(lines, 'E1368: Static cannot be followed by "this" in a variable name')
# Test for "static" cannot be followed by "public".
lines =<< trim END
@ -1282,7 +1282,7 @@ def Test_class_variable_access()
var b = B.new()
b.Foo()
END
v9.CheckSourceFailure(lines, 'E1333: Cannot access private member: _priv_class_var')
v9.CheckSourceFailure(lines, 'E1333: Cannot access private variable: _priv_class_var')
# A private class variable cannot be modified from a child class
lines =<< trim END
@ -1300,7 +1300,7 @@ def Test_class_variable_access()
var b = B.new()
b.Foo()
END
v9.CheckSourceFailure(lines, 'E1333: Cannot access private member: _priv_class_var')
v9.CheckSourceFailure(lines, 'E1333: Cannot access private variable: _priv_class_var')
# Access from child class extending a class and from script context
lines =<< trim END
@ -1689,7 +1689,7 @@ def Test_class_member()
var a = A.new()
var v = a.bar
END
v9.CheckSourceFailure(lines, 'E1326: Member not found on object "A": bar')
v9.CheckSourceFailure(lines, 'E1326: Variable not found on object "A": bar')
enddef
func Test_class_garbagecollect()
@ -1881,7 +1881,7 @@ def Test_class_defcompile()
defcompile C.new
END
v9.CheckSourceFailure(lines, 'E1370: Cannot define a "new" function as static')
v9.CheckSourceFailure(lines, 'E1370: Cannot define a "new" method as static')
# Trying to compile a function using a non-existing class variable
lines =<< trim END
@ -2103,7 +2103,7 @@ def Test_class_implements_interface()
enddef
endclass
END
v9.CheckSourceFailure(lines, 'E1348: Member "counter" of interface "Some" is not implemented')
v9.CheckSourceFailure(lines, 'E1348: Variable "counter" of interface "Some" is not implemented')
lines =<< trim END
vim9script
@ -2718,7 +2718,7 @@ def Test_class_extends()
endclass
var c = Child.new()
END
v9.CheckSourceFailure(lines, 'E1375: Class member "new" accessible only using class "Child"')
v9.CheckSourceFailure(lines, 'E1385: Class method "new" accessible only using class "Child"')
# base class with more than one object member
lines =<< trim END
@ -4000,7 +4000,7 @@ def Test_static_inheritence()
assert_equal(102, ob.AccessObject())
assert_equal(103, oc.AccessObject())
assert_fails('echo oc.AccessPrivateStaticThroughClassName()', 'E1333: Cannot access private member: _svar')
assert_fails('echo oc.AccessPrivateStaticThroughClassName()', 'E1333: Cannot access private variable: _svar')
# verify object properly resolves to correct static
assert_equal(1, oa.AccessStaticThroughObject())
@ -4020,7 +4020,7 @@ def Test_dup_member_variable()
this.val = 20
endclass
END
v9.CheckSourceFailure(lines, 'E1369: Duplicate member: val')
v9.CheckSourceFailure(lines, 'E1369: Duplicate variable: val')
# Duplicate private member variable
lines =<< trim END
@ -4030,7 +4030,7 @@ def Test_dup_member_variable()
this._val = 20
endclass
END
v9.CheckSourceFailure(lines, 'E1369: Duplicate member: _val')
v9.CheckSourceFailure(lines, 'E1369: Duplicate variable: _val')
# Duplicate public member variable
lines =<< trim END
@ -4040,7 +4040,7 @@ def Test_dup_member_variable()
public this.val = 20
endclass
END
v9.CheckSourceFailure(lines, 'E1369: Duplicate member: val')
v9.CheckSourceFailure(lines, 'E1369: Duplicate variable: val')
# Duplicate private member variable
lines =<< trim END
@ -4050,7 +4050,7 @@ def Test_dup_member_variable()
this._val = 20
endclass
END
v9.CheckSourceFailure(lines, 'E1369: Duplicate member: _val')
v9.CheckSourceFailure(lines, 'E1369: Duplicate variable: _val')
# Duplicate public and private member variable
lines =<< trim END
@ -4060,7 +4060,7 @@ def Test_dup_member_variable()
public this.val = 10
endclass
END
v9.CheckSourceFailure(lines, 'E1369: Duplicate member: val')
v9.CheckSourceFailure(lines, 'E1369: Duplicate variable: val')
# Duplicate class member variable
lines =<< trim END
@ -4070,7 +4070,7 @@ def Test_dup_member_variable()
static _s: string = "def"
endclass
END
v9.CheckSourceFailure(lines, 'E1369: Duplicate member: _s')
v9.CheckSourceFailure(lines, 'E1369: Duplicate variable: _s')
# Duplicate public and private class member variable
lines =<< trim END
@ -4080,7 +4080,7 @@ def Test_dup_member_variable()
static _s: string = "def"
endclass
END
v9.CheckSourceFailure(lines, 'E1369: Duplicate member: _s')
v9.CheckSourceFailure(lines, 'E1369: Duplicate variable: _s')
# Duplicate class and object member variable
lines =<< trim END
@ -4109,7 +4109,7 @@ def Test_dup_member_variable()
this.val = 20
endclass
END
v9.CheckSourceFailure(lines, 'E1369: Duplicate member: val')
v9.CheckSourceFailure(lines, 'E1369: Duplicate variable: val')
# Duplicate object private member variable in a derived class
lines =<< trim END
@ -4123,7 +4123,7 @@ def Test_dup_member_variable()
this._val = 20
endclass
END
v9.CheckSourceFailure(lines, 'E1369: Duplicate member: _val')
v9.CheckSourceFailure(lines, 'E1369: Duplicate variable: _val')
# Duplicate object private member variable in a derived class
lines =<< trim END
@ -4137,7 +4137,7 @@ def Test_dup_member_variable()
this._val = 20
endclass
END
v9.CheckSourceFailure(lines, 'E1369: Duplicate member: _val')
v9.CheckSourceFailure(lines, 'E1369: Duplicate variable: _val')
# Duplicate object member variable in a derived class
lines =<< trim END
@ -4151,7 +4151,7 @@ def Test_dup_member_variable()
this.val = 20
endclass
END
v9.CheckSourceFailure(lines, 'E1369: Duplicate member: val')
v9.CheckSourceFailure(lines, 'E1369: Duplicate variable: val')
# Two member variables with a common prefix
lines =<< trim END
@ -4181,7 +4181,7 @@ def Test_private_member_access_outside_class()
enddef
T()
END
v9.CheckSourceFailure(lines, 'E1333: Cannot access private member: _val')
v9.CheckSourceFailure(lines, 'E1333: Cannot access private variable: _val')
# access a non-existing private object member variable
lines =<< trim END
@ -4195,7 +4195,7 @@ def Test_private_member_access_outside_class()
enddef
T()
END
v9.CheckSourceFailure(lines, 'E1326: Member not found on object "A": _a')
v9.CheckSourceFailure(lines, 'E1326: Variable not found on object "A": _a')
# private static member variable
lines =<< trim END
@ -4209,7 +4209,7 @@ def Test_private_member_access_outside_class()
enddef
T()
END
v9.CheckSourceFailure(lines, 'E1375: Class member "_val" accessible only using class "A"')
v9.CheckSourceFailure(lines, 'E1375: Class variable "_val" accessible only using class "A"')
# private static member variable
lines =<< trim END
@ -4223,7 +4223,7 @@ def Test_private_member_access_outside_class()
enddef
T()
END
v9.CheckSourceFailure(lines, 'E1375: Class member "_val" accessible only using class "A"')
v9.CheckSourceFailure(lines, 'E1375: Class variable "_val" accessible only using class "A"')
# private static class variable
lines =<< trim END
@ -4236,7 +4236,7 @@ def Test_private_member_access_outside_class()
enddef
T()
END
v9.CheckSourceFailure(lines, 'E1333: Cannot access private member: _val')
v9.CheckSourceFailure(lines, 'E1333: Cannot access private variable: _val')
# private static class variable
lines =<< trim END
@ -4249,7 +4249,7 @@ def Test_private_member_access_outside_class()
enddef
T()
END
v9.CheckSourceFailure(lines, 'E1333: Cannot access private member: _val')
v9.CheckSourceFailure(lines, 'E1333: Cannot access private variable: _val')
enddef
" Test for changing the member access of an interface in a implementation class
@ -4263,7 +4263,7 @@ def Test_change_interface_member_access()
this.val = 10
endclass
END
v9.CheckSourceFailure(lines, 'E1367: Access level of member "val" of interface "A" is different')
v9.CheckSourceFailure(lines, 'E1367: Access level of variable "val" of interface "A" is different')
lines =<< trim END
vim9script
@ -4274,7 +4274,7 @@ def Test_change_interface_member_access()
public this.val = 10
endclass
END
v9.CheckSourceFailure(lines, 'E1367: Access level of member "val" of interface "A" is different')
v9.CheckSourceFailure(lines, 'E1367: Access level of variable "val" of interface "A" is different')
enddef
" Test for trying to change a readonly member from a def function
@ -4310,7 +4310,7 @@ def Test_modify_class_member_from_def_function()
A.var3 = {c: 3, d: 4}
assert_equal([3, 4], A.var2)
assert_equal({c: 3, d: 4}, A.var3)
assert_fails('echo A._priv_var4', 'E1333: Cannot access private member: _priv_var4')
assert_fails('echo A._priv_var4', 'E1333: Cannot access private variable: _priv_var4')
enddef
T()
END
@ -4352,7 +4352,7 @@ def Test_class_variable_access_using_object()
var a = A.new()
echo a.svar2
END
v9.CheckSourceFailure(lines, 'E1375: Class member "svar2" accessible only using class "A"')
v9.CheckSourceFailure(lines, 'E1375: Class variable "svar2" accessible only using class "A"')
# Cannot write to a class variable using an object in script context
lines =<< trim END
@ -4365,7 +4365,7 @@ def Test_class_variable_access_using_object()
var a = A.new()
a.svar2 = [2]
END
v9.CheckSourceFailure(lines, 'E1375: Class member "svar2" accessible only using class "A"')
v9.CheckSourceFailure(lines, 'E1375: Class variable "svar2" accessible only using class "A"')
# Cannot read from a class variable using an object in def method context
lines =<< trim END
@ -4381,7 +4381,7 @@ def Test_class_variable_access_using_object()
enddef
T()
END
v9.CheckSourceFailure(lines, 'E1375: Class member "svar2" accessible only using class "A"')
v9.CheckSourceFailure(lines, 'E1375: Class variable "svar2" accessible only using class "A"')
# Cannot write to a class variable using an object in def method context
lines =<< trim END
@ -4397,7 +4397,7 @@ def Test_class_variable_access_using_object()
enddef
T()
END
v9.CheckSourceFailure(lines, 'E1375: Class member "svar2" accessible only using class "A"')
v9.CheckSourceFailure(lines, 'E1375: Class variable "svar2" accessible only using class "A"')
enddef
" Test for using a interface method using a child object
@ -4636,7 +4636,7 @@ def Test_class_method_call_from_subclass()
var b = B.new()
b.Bar()
END
v9.CheckSourceFailure(lines, 'E1374: Class member "Foo" accessible only inside class "A"')
v9.CheckSourceFailure(lines, 'E1384: Class method "Foo" accessible only inside class "A"')
enddef
" Test for calling a class method using an object in a def function context and
@ -4680,7 +4680,7 @@ def Test_class_method_call_using_object()
var a = A.new()
assert_equal('foo', a.Foo())
END
v9.CheckSourceFailure(lines, 'E1375: Class member "Foo" accessible only using class "A"')
v9.CheckSourceFailure(lines, 'E1385: Class method "Foo" accessible only using class "A"')
# def function context
lines =<< trim END
@ -4697,7 +4697,7 @@ def Test_class_method_call_using_object()
enddef
T()
END
v9.CheckSourceFailure(lines, 'E1375: Class member "Foo" accessible only using class "A"')
v9.CheckSourceFailure(lines, 'E1385: Class method "Foo" accessible only using class "A"')
enddef
def Test_class_variable()
@ -4750,7 +4750,7 @@ def Test_class_variable()
endclass
B.ClassFunc()
END
v9.CheckSourceFailure(lines, 'E1374: Class member "val" accessible only inside class "A"')
v9.CheckSourceFailure(lines, 'E1374: Class variable "val" accessible only inside class "A"')
# Reading a parent class variable from a child class method
lines =<< trim END
@ -4767,7 +4767,7 @@ def Test_class_variable()
endclass
B.ClassFunc()
END
v9.CheckSourceFailure(lines, 'E1374: Class member "val" accessible only inside class "A"')
v9.CheckSourceFailure(lines, 'E1374: Class variable "val" accessible only inside class "A"')
# Modifying a parent class variable from a child object method
lines =<< trim END
@ -4785,7 +4785,7 @@ def Test_class_variable()
var b = B.new()
b.ObjFunc()
END
v9.CheckSourceFailure(lines, 'E1374: Class member "val" accessible only inside class "A"')
v9.CheckSourceFailure(lines, 'E1374: Class variable "val" accessible only inside class "A"')
# Reading a parent class variable from a child object method
lines =<< trim END
@ -4803,7 +4803,7 @@ def Test_class_variable()
var b = B.new()
b.ObjFunc()
END
v9.CheckSourceFailure(lines, 'E1374: Class member "val" accessible only inside class "A"')
v9.CheckSourceFailure(lines, 'E1374: Class variable "val" accessible only inside class "A"')
# Modifying a class variable using an object at script level
lines =<< trim END
@ -4815,7 +4815,7 @@ def Test_class_variable()
var a = A.new()
a.val = 20
END
v9.CheckSourceFailure(lines, 'E1375: Class member "val" accessible only using class "A"')
v9.CheckSourceFailure(lines, 'E1375: Class variable "val" accessible only using class "A"')
# Reading a class variable using an object at script level
lines =<< trim END
@ -4827,7 +4827,7 @@ def Test_class_variable()
var a = A.new()
var i = a.val
END
v9.CheckSourceFailure(lines, 'E1375: Class member "val" accessible only using class "A"')
v9.CheckSourceFailure(lines, 'E1375: Class variable "val" accessible only using class "A"')
# Modifying a class variable using an object at function level
lines =<< trim END
@ -4843,7 +4843,7 @@ def Test_class_variable()
enddef
T()
END
v9.CheckSourceFailure(lines, 'E1375: Class member "val" accessible only using class "A"')
v9.CheckSourceFailure(lines, 'E1375: Class variable "val" accessible only using class "A"')
# Reading a class variable using an object at function level
lines =<< trim END
@ -4858,7 +4858,7 @@ def Test_class_variable()
enddef
T()
END
v9.CheckSourceFailure(lines, 'E1375: Class member "val" accessible only using class "A"')
v9.CheckSourceFailure(lines, 'E1375: Class variable "val" accessible only using class "A"')
enddef
" Test for using a duplicate class method and class variable in a child class
@ -4957,7 +4957,7 @@ def Test_instance_method_call_using_class()
endclass
A.Foo()
END
v9.CheckSourceFailure(lines, 'E1376: Object member "Foo" accessible only using class "A" object')
v9.CheckSourceFailure(lines, 'E1386: Object method "Foo" accessible only using class "A" object')
# Invoke an object method using a class in def function context
lines =<< trim END
@ -4972,7 +4972,7 @@ def Test_instance_method_call_using_class()
enddef
T()
END
v9.CheckSourceFailure(lines, 'E1376: Object member "Foo" accessible only using class "A" object')
v9.CheckSourceFailure(lines, 'E1386: Object method "Foo" accessible only using class "A" object')
enddef
" Test for duplicate class method and instance method
@ -5218,7 +5218,7 @@ def Test_extend_interface()
enddef
endclass
END
v9.CheckSourceFailure(lines, 'E1348: Member "var2" of interface "B" is not implemented')
v9.CheckSourceFailure(lines, 'E1348: Variable "var2" of interface "B" is not implemented')
# interface cannot extend a class
lines =<< trim END
@ -5276,7 +5276,7 @@ def Test_extend_interface()
this.val2: number
endinterface
END
v9.CheckSourceFailure(lines, 'E1382: Member "val1": type mismatch, expected number but got string')
v9.CheckSourceFailure(lines, 'E1382: Variable "val1": type mismatch, expected number but got string')
enddef
" Test for a child class implementing an interface when some of the methods are
@ -5433,7 +5433,7 @@ def Test_child_class_implements_interface()
this.var1 = [{a: 10}]
endclass
END
v9.CheckSourceFailure(lines, 'E1348: Member "var3" of interface "Intf" is not implemented')
v9.CheckSourceFailure(lines, 'E1348: Variable "var3" of interface "Intf" is not implemented')
# One of the interface variables is of different type
lines =<< trim END
@ -5460,7 +5460,7 @@ def Test_child_class_implements_interface()
this.var1 = [{a: 10}]
endclass
END
v9.CheckSourceFailure(lines, 'E1382: Member "var3": type mismatch, expected list<dict<number>> but got list<dict<string>>')
v9.CheckSourceFailure(lines, 'E1382: Variable "var3": type mismatch, expected list<dict<number>> but got list<dict<string>>')
enddef
" Test for extending an interface with duplicate variables and methods
@ -5531,7 +5531,7 @@ def Test_implements_using_var_type_any()
endclass
var b = B.new()
END
v9.CheckSourceFailure(lines, 'E1382: Member "val": type mismatch, expected list<dict<string>> but got dict<number>')
v9.CheckSourceFailure(lines, 'E1382: Variable "val": type mismatch, expected list<dict<string>> but got dict<number>')
enddef
" Test for assigning to a member variable in a nested class

View File

@ -699,6 +699,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1935,
/**/
1934,
/**/

View File

@ -79,7 +79,7 @@ parse_member(
*varname_end = to_name_end(varname, FALSE);
if (*varname == '_' && has_public)
{
semsg(_(e_public_member_name_cannot_start_with_underscore_str), line);
semsg(_(e_public_variable_name_cannot_start_with_underscore_str), line);
return FAIL;
}
@ -113,7 +113,7 @@ parse_member(
if (init_expr == NULL && *init_arg == '=')
{
emsg(_(e_cannot_initialize_member_in_interface));
emsg(_(e_cannot_initialize_variable_in_interface));
return FAIL;
}
@ -426,7 +426,7 @@ extends_check_dup_members(
? p_m->ocm_name + 1 : p_m->ocm_name;
if (STRCMP(pstr, qstr) == 0)
{
semsg(_(e_duplicate_member_str), c_m->ocm_name);
semsg(_(e_duplicate_variable_str), c_m->ocm_name);
return FALSE;
}
}
@ -586,7 +586,7 @@ intf_variable_present(
// Ensure the access type is same
if (if_var->ocm_access != m->ocm_access)
{
semsg(_(e_member_str_of_interface_str_has_different_access),
semsg(_(e_variable_str_of_interface_str_has_different_access),
if_var->ocm_name, intf_class_name);
return FALSE;
}
@ -662,7 +662,7 @@ validate_interface_variables(
if (!intf_variable_present(intf_class_name, &if_ms[if_i],
is_class_var, cl_ms, cl_count, extends_cl))
{
semsg(_(e_member_str_of_interface_str_not_implemented),
semsg(_(e_variable_str_of_interface_str_not_implemented),
if_ms[if_i].ocm_name, intf_class_name);
return FALSE;
}
@ -908,7 +908,7 @@ is_duplicate_member(garray_T *mgap, char_u *varname, char_u *varname_end)
char_u *qstr = *m->ocm_name == '_' ? m->ocm_name + 1 : m->ocm_name;
if (STRCMP(pstr, qstr) == 0)
{
semsg(_(e_duplicate_member_str), name);
semsg(_(e_duplicate_variable_str), name);
dup = TRUE;
break;
}
@ -957,20 +957,20 @@ is_valid_constructor(ufunc_T *uf, int is_abstract, int has_static)
// Constructors are not allowed in abstract classes.
if (is_abstract)
{
emsg(_(e_cannot_define_new_function_in_abstract_class));
emsg(_(e_cannot_define_new_method_in_abstract_class));
return FALSE;
}
// A constructor is always static, no need to define it so.
if (has_static)
{
emsg(_(e_cannot_define_new_function_as_static));
emsg(_(e_cannot_define_new_method_as_static));
return FALSE;
}
// A return type should not be specified for the new()
// constructor method.
if (uf->uf_ret_type->tt_type != VAR_VOID)
{
emsg(_(e_cannot_use_a_return_type_with_new));
emsg(_(e_cannot_use_a_return_type_with_new_method));
return FALSE;
}
return TRUE;
@ -1608,7 +1608,7 @@ early_ret:
{
if (p[4] != '.' || !eval_isnamec1(p[5]))
{
semsg(_(e_invalid_object_member_declaration_str), p);
semsg(_(e_invalid_object_variable_declaration_str), p);
break;
}
if (has_static)
@ -2074,7 +2074,7 @@ get_member_tv(
if (*name == '_')
{
semsg(_(e_cannot_access_private_member_str), m->ocm_name);
semsg(_(e_cannot_access_private_variable_str), m->ocm_name);
return FAIL;
}
@ -2233,7 +2233,7 @@ class_object_index(
if (*name == '_')
{
semsg(_(e_cannot_access_private_member_str), m->ocm_name);
semsg(_(e_cannot_access_private_variable_str), m->ocm_name);
return FAIL;
}
@ -2770,7 +2770,7 @@ method_not_found_msg(class_T *cl, vartype_T v_type, char_u *name, size_t len)
if (*name == '_')
semsg(_(e_cannot_access_private_method_str), method_name);
else
semsg(_(e_class_member_str_accessible_only_using_class_str),
semsg(_(e_class_method_str_accessible_only_using_class_str),
method_name, cl->class_name);
}
else if ((v_type == VAR_CLASS)
@ -2780,7 +2780,7 @@ method_not_found_msg(class_T *cl, vartype_T v_type, char_u *name, size_t len)
if (*name == '_')
semsg(_(e_cannot_access_private_method_str), method_name);
else
semsg(_(e_object_member_str_accessible_only_using_object_str),
semsg(_(e_object_method_str_accessible_only_using_object_str),
method_name, cl->class_name);
}
else
@ -2800,19 +2800,19 @@ member_not_found_msg(class_T *cl, vartype_T v_type, char_u *name, size_t len)
if (v_type == VAR_OBJECT)
{
if (class_member_idx(cl, name, len) >= 0)
semsg(_(e_class_member_str_accessible_only_using_class_str),
semsg(_(e_class_variable_str_accessible_only_using_class_str),
varname, cl->class_name);
else
semsg(_(e_member_not_found_on_object_str_str), cl->class_name,
semsg(_(e_variable_not_found_on_object_str_str), cl->class_name,
varname);
}
else
{
if (object_member_idx(cl, name, len) >= 0)
semsg(_(e_object_member_str_accessible_only_using_object_str),
semsg(_(e_object_variable_str_accessible_only_using_object_str),
varname, cl->class_name);
else
semsg(_(e_class_member_str_not_found_in_class_str),
semsg(_(e_class_variable_str_not_found_in_class_str),
varname, cl->class_name);
}
vim_free(varname);

View File

@ -1610,8 +1610,8 @@ lhs_class_member_modifiable(lhs_T *lhs, char_u *var_start, cctx_T *cctx)
|| (!is_object && cctx->ctx_ufunc->uf_class != cl)))
{
char *msg = (m->ocm_access == VIM_ACCESS_PRIVATE)
? e_cannot_access_private_member_str
: e_member_is_not_writable_str;
? e_cannot_access_private_variable_str
: e_variable_is_not_writable_str;
semsg(_(msg), m->ocm_name, cl->class_name);
return FALSE;
}
@ -1750,7 +1750,7 @@ compile_lhs(
{
// A class variable can be accessed without the class name
// only inside a class.
semsg(_(e_class_member_str_accessible_only_inside_class_str),
semsg(_(e_class_variable_str_accessible_only_inside_class_str),
lhs->lhs_name, defcl->class_name);
return FAIL;
}

View File

@ -2181,7 +2181,7 @@ execute_storeindex(isn_T *iptr, ectx_T *ectx)
{
if (*member == '_')
{
semsg(_(e_cannot_access_private_member_str), m->ocm_name);
semsg(_(e_cannot_access_private_variable_str), m->ocm_name);
status = FAIL;
}

View File

@ -293,7 +293,7 @@ compile_class_object_index(cctx_T *cctx, char_u **arg, type_T *type)
{
if (cctx->ctx_ufunc == NULL || cctx->ctx_ufunc->uf_class == NULL)
{
emsg(_(e_using_super_not_in_class_function));
emsg(_(e_using_super_not_in_class_method));
return FAIL;
}
is_super = TRUE;
@ -407,7 +407,7 @@ compile_class_object_index(cctx_T *cctx, char_u **arg, type_T *type)
{
if (*name == '_' && !inside_class(cctx, cl))
{
semsg(_(e_cannot_access_private_member_str), m->ocm_name);
semsg(_(e_cannot_access_private_variable_str), m->ocm_name);
return FAIL;
}
@ -443,7 +443,7 @@ compile_class_object_index(cctx_T *cctx, char_u **arg, type_T *type)
// it is defined.
if (*name == '_' && cctx->ctx_ufunc->uf_class != cl)
{
semsg(_(e_cannot_access_private_member_str), m->ocm_name);
semsg(_(e_cannot_access_private_variable_str), m->ocm_name);
return FAIL;
}
@ -772,7 +772,7 @@ compile_load(
res = generate_CLASSMEMBER(cctx, TRUE, cl, idx);
else
{
semsg(_(e_class_member_str_accessible_only_inside_class_str),
semsg(_(e_class_variable_str_accessible_only_inside_class_str),
name, cl->class_name);
res = FAIL;
}
@ -1151,7 +1151,7 @@ compile_call(
}
else
{
semsg(_(e_class_member_str_accessible_only_inside_class_str),
semsg(_(e_class_method_str_accessible_only_inside_class_str),
name, cl->class_name);
res = FAIL;
}

View File

@ -648,7 +648,7 @@ valid_declaration_type(type_T *type)
{
char *tofree = NULL;
char *name = type_name(type, &tofree);
semsg(_(e_invalid_type_for_object_member_str), name);
semsg(_(e_invalid_type_for_object_variable_str), name);
vim_free(tofree);
return FALSE;
}
@ -755,7 +755,7 @@ type_mismatch_where(type_T *expected, type_T *actual, where_T where)
switch (where.wt_kind)
{
case WT_MEMBER:
semsg(_(e_member_str_type_mismatch_expected_str_but_got_str),
semsg(_(e_variable_str_type_mismatch_expected_str_but_got_str),
where.wt_func_name, typename1, typename2);
break;
case WT_METHOD: