Skip to content

Commit 7fe8f43

Browse files
RestorerZchrisbra
authored andcommitted
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 <[email protected]> Co-authored-by: RestorerZ <[email protected]>
1 parent 46bdae0 commit 7fe8f43

9 files changed

Lines changed: 136 additions & 128 deletions

File tree

src/errors.h

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3376,8 +3376,8 @@ EXTERN char e_white_space_required_after_name_str[]
33763376
INIT(= N_("E1315: White space required after name: %s"));
33773377
EXTERN char e_class_can_only_be_defined_in_vim9_script[]
33783378
INIT(= N_("E1316: Class can only be defined in Vim9 script"));
3379-
EXTERN char e_invalid_object_member_declaration_str[]
3380-
INIT(= N_("E1317: Invalid object member declaration: %s"));
3379+
EXTERN char e_invalid_object_variable_declaration_str[]
3380+
INIT(= N_("E1317: Invalid object variable declaration: %s"));
33813381
EXTERN char e_not_valid_command_in_class_str[]
33823382
INIT(= N_("E1318: Not a valid command in a class: %s"));
33833383
EXTERN char e_using_class_as_number[]
@@ -3394,30 +3394,30 @@ EXTERN char e_using_object_as_string[]
33943394
INIT(= N_("E1324: Using an object as a String"));
33953395
EXTERN char e_method_not_found_on_class_str_str[]
33963396
INIT(= N_("E1325: Method not found on class \"%s\": %s"));
3397-
EXTERN char e_member_not_found_on_object_str_str[]
3398-
INIT(= N_("E1326: Member not found on object \"%s\": %s"));
3397+
EXTERN char e_variable_not_found_on_object_str_str[]
3398+
INIT(= N_("E1326: Variable not found on object \"%s\": %s"));
33993399
EXTERN char e_object_required_found_str[]
34003400
INIT(= N_("E1327: Object required, found %s"));
34013401
EXTERN char e_constructor_default_value_must_be_vnone_str[]
34023402
INIT(= N_("E1328: Constructor default value must be v:none: %s"));
34033403
// E1329 unused
3404-
EXTERN char e_invalid_type_for_object_member_str[]
3405-
INIT(= N_("E1330: Invalid type for object member: %s"));
3404+
EXTERN char e_invalid_type_for_object_variable_str[]
3405+
INIT(= N_("E1330: Invalid type for object variable: %s"));
34063406
EXTERN char e_public_must_be_followed_by_this_or_static[]
34073407
INIT(= N_("E1331: Public must be followed by \"this\" or \"static\""));
3408-
EXTERN char e_public_member_name_cannot_start_with_underscore_str[]
3409-
INIT(= N_("E1332: Public member name cannot start with underscore: %s"));
3410-
EXTERN char e_cannot_access_private_member_str[]
3411-
INIT(= N_("E1333: Cannot access private member: %s"));
3408+
EXTERN char e_public_variable_name_cannot_start_with_underscore_str[]
3409+
INIT(= N_("E1332: Public variable name cannot start with underscore: %s"));
3410+
EXTERN char e_cannot_access_private_variable_str[]
3411+
INIT(= N_("E1333: Cannot access private variable: %s"));
34123412
// E1334 unused
3413-
EXTERN char e_member_is_not_writable_str[]
3413+
EXTERN char e_variable_is_not_writable_str[]
34143414
INIT(= N_("E1335: Variable \"%s\" in class \"%s\" is not writable"));
34153415
#endif
34163416
EXTERN char e_internal_error_shortmess_too_long[]
34173417
INIT(= "E1336: Internal error: shortmess too long");
34183418
#ifdef FEAT_EVAL
3419-
EXTERN char e_class_member_str_not_found_in_class_str[]
3420-
INIT(= N_("E1337: Class member \"%s\" not found in class \"%s\""));
3419+
EXTERN char e_class_variable_str_not_found_in_class_str[]
3420+
INIT(= N_("E1337: Class variable \"%s\" not found in class \"%s\""));
34213421
// E1338 unused
34223422
#endif
34233423
#ifdef FEAT_PROP_POPUP
@@ -3433,16 +3433,16 @@ EXTERN char e_interface_can_only_be_defined_in_vim9_script[]
34333433
INIT(= N_("E1342: Interface can only be defined in Vim9 script"));
34343434
EXTERN char e_interface_name_must_start_with_uppercase_letter_str[]
34353435
INIT(= N_("E1343: Interface name must start with an uppercase letter: %s"));
3436-
EXTERN char e_cannot_initialize_member_in_interface[]
3437-
INIT(= N_("E1344: Cannot initialize a member in an interface"));
3436+
EXTERN char e_cannot_initialize_variable_in_interface[]
3437+
INIT(= N_("E1344: Cannot initialize a variable in an interface"));
34383438
EXTERN char e_not_valid_command_in_interface_str[]
34393439
INIT(= N_("E1345: Not a valid command in an interface: %s"));
34403440
EXTERN char e_interface_name_not_found_str[]
34413441
INIT(= N_("E1346: Interface name not found: %s"));
34423442
EXTERN char e_not_valid_interface_str[]
34433443
INIT(= N_("E1347: Not a valid interface: %s"));
3444-
EXTERN char e_member_str_of_interface_str_not_implemented[]
3445-
INIT(= N_("E1348: Member \"%s\" of interface \"%s\" is not implemented"));
3444+
EXTERN char e_variable_str_of_interface_str_not_implemented[]
3445+
INIT(= N_("E1348: Variable \"%s\" of interface \"%s\" is not implemented"));
34463446
EXTERN char e_method_str_of_interface_str_not_implemented[]
34473447
INIT(= N_("E1349: Method \"%s\" of interface \"%s\" is not implemented"));
34483448
EXTERN char e_duplicate_implements[]
@@ -3459,12 +3459,12 @@ EXTERN char e_duplicate_function_str[]
34593459
INIT(= N_("E1355: Duplicate function: %s"));
34603460
EXTERN char e_super_must_be_followed_by_dot[]
34613461
INIT(= N_("E1356: \"super\" must be followed by a dot"));
3462-
EXTERN char e_using_super_not_in_class_function[]
3463-
INIT(= N_("E1357: Using \"super\" not in a class function"));
3462+
EXTERN char e_using_super_not_in_class_method[]
3463+
INIT(= N_("E1357: Using \"super\" not in a class method"));
34643464
EXTERN char e_using_super_not_in_child_class[]
34653465
INIT(= N_("E1358: Using \"super\" not in a child class"));
3466-
EXTERN char e_cannot_define_new_function_in_abstract_class[]
3467-
INIT(= N_("E1359: Cannot define a \"new\" function in an abstract class"));
3466+
EXTERN char e_cannot_define_new_method_in_abstract_class[]
3467+
INIT(= N_("E1359: Cannot define a \"new\" method in an abstract class"));
34683468
EXTERN char e_using_null_object[]
34693469
INIT(= N_("E1360: Using a null object"));
34703470
#endif
@@ -3479,30 +3479,30 @@ EXTERN char e_incomplete_type[]
34793479
EXTERN char e_warning_pointer_block_corrupted[]
34803480
INIT(= N_("E1364: Warning: Pointer block corrupted"));
34813481
#ifdef FEAT_EVAL
3482-
EXTERN char e_cannot_use_a_return_type_with_new[]
3483-
INIT(= N_("E1365: Cannot use a return type with the \"new\" function"));
3482+
EXTERN char e_cannot_use_a_return_type_with_new_method[]
3483+
INIT(= N_("E1365: Cannot use a return type with the \"new\" method"));
34843484
EXTERN char e_cannot_access_private_method_str[]
34853485
INIT(= N_("E1366: Cannot access private method: %s"));
3486-
EXTERN char e_member_str_of_interface_str_has_different_access[]
3487-
INIT(= N_("E1367: Access level of member \"%s\" of interface \"%s\" is different"));
3486+
EXTERN char e_variable_str_of_interface_str_has_different_access[]
3487+
INIT(= N_("E1367: Access level of variable \"%s\" of interface \"%s\" is different"));
34883488
EXTERN char e_static_cannot_be_followed_by_this[]
3489-
INIT(= N_("E1368: Static cannot be followed by \"this\" in a member name"));
3490-
EXTERN char e_duplicate_member_str[]
3491-
INIT(= N_("E1369: Duplicate member: %s"));
3492-
EXTERN char e_cannot_define_new_function_as_static[]
3493-
INIT(= N_("E1370: Cannot define a \"new\" function as static"));
3489+
INIT(= N_("E1368: Static cannot be followed by \"this\" in a variable name"));
3490+
EXTERN char e_duplicate_variable_str[]
3491+
INIT(= N_("E1369: Duplicate variable: %s"));
3492+
EXTERN char e_cannot_define_new_method_as_static[]
3493+
INIT(= N_("E1370: Cannot define a \"new\" method as static"));
34943494
EXTERN char e_abstract_must_be_followed_by_def_or_static[]
34953495
INIT(= N_("E1371: Abstract must be followed by \"def\" or \"static\""));
34963496
EXTERN char e_abstract_method_in_concrete_class[]
34973497
INIT(= N_("E1372: Abstract method \"%s\" cannot be defined in a concrete class"));
34983498
EXTERN char e_abstract_method_str_not_found[]
34993499
INIT(= N_("E1373: Abstract method \"%s\" is not implemented"));
3500-
EXTERN char e_class_member_str_accessible_only_inside_class_str[]
3501-
INIT(= N_("E1374: Class member \"%s\" accessible only inside class \"%s\""));
3502-
EXTERN char e_class_member_str_accessible_only_using_class_str[]
3503-
INIT(= N_("E1375: Class member \"%s\" accessible only using class \"%s\""));
3504-
EXTERN char e_object_member_str_accessible_only_using_object_str[]
3505-
INIT(= N_("E1376: Object member \"%s\" accessible only using class \"%s\" object"));
3500+
EXTERN char e_class_variable_str_accessible_only_inside_class_str[]
3501+
INIT(= N_("E1374: Class variable \"%s\" accessible only inside class \"%s\""));
3502+
EXTERN char e_class_variable_str_accessible_only_using_class_str[]
3503+
INIT(= N_("E1375: Class variable \"%s\" accessible only using class \"%s\""));
3504+
EXTERN char e_object_variable_str_accessible_only_using_object_str[]
3505+
INIT(= N_("E1376: Object variable \"%s\" accessible only using class \"%s\" object"));
35063506
EXTERN char e_method_str_of_class_str_has_different_access[]
35073507
INIT(= N_("E1377: Access level of method \"%s\" is different in class \"%s\""));
35083508
EXTERN char e_static_member_not_supported_in_interface[]
@@ -3513,10 +3513,16 @@ EXTERN char e_private_method_not_supported_in_interface[]
35133513
INIT(= N_("E1380: Private method not supported in an interface"));
35143514
EXTERN char e_interface_cannot_use_implements[]
35153515
INIT(= N_("E1381: Interface cannot use \"implements\""));
3516-
EXTERN char e_member_str_type_mismatch_expected_str_but_got_str[]
3517-
INIT(= N_("E1382: Member \"%s\": type mismatch, expected %s but got %s"));
3516+
EXTERN char e_variable_str_type_mismatch_expected_str_but_got_str[]
3517+
INIT(= N_("E1382: Variable \"%s\": type mismatch, expected %s but got %s"));
35183518
EXTERN char e_method_str_type_mismatch_expected_str_but_got_str[]
35193519
INIT(= N_("E1383: Method \"%s\": type mismatch, expected %s but got %s"));
3520+
EXTERN char e_class_method_str_accessible_only_inside_class_str[]
3521+
INIT(= N_("E1384: Class method \"%s\" accessible only inside class \"%s\""));
3522+
EXTERN char e_class_method_str_accessible_only_using_class_str[]
3523+
INIT(= N_("E1385: Class method \"%s\" accessible only using class \"%s\""));
3524+
EXTERN char e_object_method_str_accessible_only_using_object_str[]
3525+
INIT(= N_("E1386: Object method \"%s\" accessible only using class \"%s\" object"));
35203526
#endif
35213527
EXTERN char e_cannot_mix_positional_and_non_positional_str[]
35223528
INIT(= N_("E1400: Cannot mix positional and non-positional arguments: %s"));
@@ -3532,4 +3538,4 @@ EXTERN char e_invalid_format_specifier_str[]
35323538
INIT(= N_("E1405: Invalid format specifier: %s"));
35333539
EXTERN char e_aptypes_is_null_nr_str[]
35343540
INIT(= "E1408: Internal error: ap_types or ap_types[idx] is NULL: %d: %s");
3535-
// E1384 - E1399 unused
3541+
// E1387 - E1399 unused

src/eval.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,7 @@ get_lval(
15601560
switch (om->ocm_access)
15611561
{
15621562
case VIM_ACCESS_PRIVATE:
1563-
semsg(_(e_cannot_access_private_member_str),
1563+
semsg(_(e_cannot_access_private_variable_str),
15641564
om->ocm_name);
15651565
return NULL;
15661566
case VIM_ACCESS_READ:
@@ -1569,7 +1569,7 @@ get_lval(
15691569
break;
15701570
if ((flags & GLV_READ_ONLY) == 0)
15711571
{
1572-
semsg(_(e_member_is_not_writable_str),
1572+
semsg(_(e_variable_is_not_writable_str),
15731573
om->ocm_name, cl->class_name);
15741574
return NULL;
15751575
}

0 commit comments

Comments
 (0)