comparison src/errors.h @ 33278:b5ed566262d3 v9.0.1906

patch 9.0.1906: Vim9: Interfaces should not support class methods and variables Commit: https://github.com/vim/vim/commit/92d9ee5f4ca0d2de04c39afbafc7609da43fb2e9 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sun Sep 17 17:03:19 2023 +0200 patch 9.0.1906: Vim9: Interfaces should not support class methods and variables Problem: Vim9: Interfaces should not support class methods and variables Solution: Make sure interface follow the interface specification Vim9 interface changes to follow the new interface specification: 1) An interface can have only read-only and read-write instance variables. 2) An interface can have only public instance methods. 3) An interface cannot have class variables and class methods. 4) An interface cannot have private instance variables and private instance methods. 5) A interface can extend another interface using "extends". The sub-interface gets all the variables and methods in the super interface. That means: - Interfaces should not support class methods and variables. - Adjust error numbers and add additional tests. - Interface methods can be defined in one of the super classes. - Interface variables can be defined in one of the super classes. and instance variables can be repeated in sub interfaces. - Check the class variable types with the type in interface. closes: #13100 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author Christian Brabandt <cb@256bit.org>
date Sun, 17 Sep 2023 17:15:06 +0200
parents aba1fa2b7d1e
children 0c3553cfe22e
comparison
equal deleted inserted replaced
33277:106deeeba024 33278:b5ed566262d3
1570 EXTERN char e_unknown_printer_font_str[] 1570 EXTERN char e_unknown_printer_font_str[]
1571 INIT(= N_("E613: Unknown printer font: %s")); 1571 INIT(= N_("E613: Unknown printer font: %s"));
1572 #endif 1572 #endif
1573 EXTERN char e_class_required[] 1573 EXTERN char e_class_required[]
1574 INIT(= N_("E614: Class required")); 1574 INIT(= N_("E614: Class required"));
1575 EXTERN char e_object_required[] 1575 // E615 unused
1576 INIT(= N_("E615: Object required"));
1577 EXTERN char e_object_required_for_argument_nr[] 1576 EXTERN char e_object_required_for_argument_nr[]
1578 INIT(= N_("E616: Object required for argument %d")); 1577 INIT(= N_("E616: Object required for argument %d"));
1579 #ifdef FEAT_GUI_GTK 1578 #ifdef FEAT_GUI_GTK
1580 EXTERN char e_cannot_be_changed_in_gtk_GUI[] 1579 EXTERN char e_cannot_be_changed_in_gtk_GUI[]
1581 INIT(= N_("E617: Cannot be changed in the GTK GUI")); 1580 INIT(= N_("E617: Cannot be changed in the GTK GUI"));
3399 INIT(= N_("E1326: Member not found on object \"%s\": %s")); 3398 INIT(= N_("E1326: Member not found on object \"%s\": %s"));
3400 EXTERN char e_object_required_found_str[] 3399 EXTERN char e_object_required_found_str[]
3401 INIT(= N_("E1327: Object required, found %s")); 3400 INIT(= N_("E1327: Object required, found %s"));
3402 EXTERN char e_constructor_default_value_must_be_vnone_str[] 3401 EXTERN char e_constructor_default_value_must_be_vnone_str[]
3403 INIT(= N_("E1328: Constructor default value must be v:none: %s")); 3402 INIT(= N_("E1328: Constructor default value must be v:none: %s"));
3404 EXTERN char e_cannot_get_object_member_type_from_initializer_str[] 3403 // E1329 unused
3405 INIT(= N_("E1329: Cannot get object member type from initializer: %s"));
3406 EXTERN char e_invalid_type_for_object_member_str[] 3404 EXTERN char e_invalid_type_for_object_member_str[]
3407 INIT(= N_("E1330: Invalid type for object member: %s")); 3405 INIT(= N_("E1330: Invalid type for object member: %s"));
3408 EXTERN char e_public_must_be_followed_by_this_or_static[] 3406 EXTERN char e_public_must_be_followed_by_this_or_static[]
3409 INIT(= N_("E1331: Public must be followed by \"this\" or \"static\"")); 3407 INIT(= N_("E1331: Public must be followed by \"this\" or \"static\""));
3410 EXTERN char e_public_member_name_cannot_start_with_underscore_str[] 3408 EXTERN char e_public_member_name_cannot_start_with_underscore_str[]
3411 INIT(= N_("E1332: Public member name cannot start with underscore: %s")); 3409 INIT(= N_("E1332: Public member name cannot start with underscore: %s"));
3412 EXTERN char e_cannot_access_private_member_str[] 3410 EXTERN char e_cannot_access_private_member_str[]
3413 INIT(= N_("E1333: Cannot access private member: %s")); 3411 INIT(= N_("E1333: Cannot access private member: %s"));
3412 // E1334 unused
3414 EXTERN char e_member_is_not_writable_str[] 3413 EXTERN char e_member_is_not_writable_str[]
3415 INIT(= N_("E1335: Member is not writable: %s")); 3414 INIT(= N_("E1335: Member is not writable: %s"));
3416 #endif 3415 #endif
3417 EXTERN char e_internal_error_shortmess_too_long[] 3416 EXTERN char e_internal_error_shortmess_too_long[]
3418 INIT(= "E1336: Internal error: shortmess too long"); 3417 INIT(= "E1336: Internal error: shortmess too long");
3419 #ifdef FEAT_EVAL 3418 #ifdef FEAT_EVAL
3420 EXTERN char e_class_member_str_not_found_in_class_str[] 3419 EXTERN char e_class_member_str_not_found_in_class_str[]
3421 INIT(= N_("E1337: Class member \"%s\" not found in class \"%s\"")); 3420 INIT(= N_("E1337: Class member \"%s\" not found in class \"%s\""));
3422 EXTERN char e_member_not_found_on_class_str_str[] 3421 EXTERN char e_interface_static_direct_access_str[]
3423 INIT(= N_("E1338: Member not found on class \"%s\": %s")); 3422 INIT(= N_("E1338: Cannot directly access interface \"%s\" static member \"%s\""));
3424 #endif 3423 #endif
3425 #ifdef FEAT_PROP_POPUP 3424 #ifdef FEAT_PROP_POPUP
3426 EXTERN char e_cannot_add_textprop_with_text_after_using_textprop_with_negative_id[] 3425 EXTERN char e_cannot_add_textprop_with_text_after_using_textprop_with_negative_id[]
3427 INIT(= N_("E1339: Cannot add a textprop with text after using a textprop with a negative id")); 3426 INIT(= N_("E1339: Cannot add a textprop with text after using a textprop with a negative id"));
3428 #endif 3427 #endif
3442 EXTERN char e_interface_name_not_found_str[] 3441 EXTERN char e_interface_name_not_found_str[]
3443 INIT(= N_("E1346: Interface name not found: %s")); 3442 INIT(= N_("E1346: Interface name not found: %s"));
3444 EXTERN char e_not_valid_interface_str[] 3443 EXTERN char e_not_valid_interface_str[]
3445 INIT(= N_("E1347: Not a valid interface: %s")); 3444 INIT(= N_("E1347: Not a valid interface: %s"));
3446 EXTERN char e_member_str_of_interface_str_not_implemented[] 3445 EXTERN char e_member_str_of_interface_str_not_implemented[]
3447 INIT(= N_("E1348: Member \"%s\" of interface \"%s\" not implemented")); 3446 INIT(= N_("E1348: Member \"%s\" of interface \"%s\" is not implemented"));
3448 EXTERN char e_function_str_of_interface_str_not_implemented[] 3447 EXTERN char e_method_str_of_interface_str_not_implemented[]
3449 INIT(= N_("E1349: Function \"%s\" of interface \"%s\" not implemented")); 3448 INIT(= N_("E1349: Method \"%s\" of interface \"%s\" is not implemented"));
3450 EXTERN char e_duplicate_implements[] 3449 EXTERN char e_duplicate_implements[]
3451 INIT(= N_("E1350: Duplicate \"implements\"")); 3450 INIT(= N_("E1350: Duplicate \"implements\""));
3452 EXTERN char e_duplicate_interface_after_implements_str[] 3451 EXTERN char e_duplicate_interface_after_implements_str[]
3453 INIT(= N_("E1351: Duplicate interface after \"implements\": %s")); 3452 INIT(= N_("E1351: Duplicate interface after \"implements\": %s"));
3454 EXTERN char e_duplicate_extends[] 3453 EXTERN char e_duplicate_extends[]
3478 EXTERN char e_incomplete_type[] 3477 EXTERN char e_incomplete_type[]
3479 INIT(= N_("E1363: Incomplete type")); 3478 INIT(= N_("E1363: Incomplete type"));
3480 #endif 3479 #endif
3481 EXTERN char e_warning_pointer_block_corrupted[] 3480 EXTERN char e_warning_pointer_block_corrupted[]
3482 INIT(= N_("E1364: Warning: Pointer block corrupted")); 3481 INIT(= N_("E1364: Warning: Pointer block corrupted"));
3482 #ifdef FEAT_EVAL
3483 EXTERN char e_cannot_use_a_return_type_with_new[] 3483 EXTERN char e_cannot_use_a_return_type_with_new[]
3484 INIT(= N_("E1365: Cannot use a return type with the \"new\" function")); 3484 INIT(= N_("E1365: Cannot use a return type with the \"new\" function"));
3485 EXTERN char e_cannot_access_private_method_str[] 3485 EXTERN char e_cannot_access_private_method_str[]
3486 INIT(= N_("E1366: Cannot access private method: %s")); 3486 INIT(= N_("E1366: Cannot access private method: %s"));
3487 EXTERN char e_member_str_of_interface_str_has_different_access[] 3487 EXTERN char e_member_str_of_interface_str_has_different_access[]
3502 INIT(= N_("E1374: Class member \"%s\" accessible only inside class \"%s\"")); 3502 INIT(= N_("E1374: Class member \"%s\" accessible only inside class \"%s\""));
3503 EXTERN char e_class_member_str_accessible_only_using_class_str[] 3503 EXTERN char e_class_member_str_accessible_only_using_class_str[]
3504 INIT(= N_("E1375: Class member \"%s\" accessible only using class \"%s\"")); 3504 INIT(= N_("E1375: Class member \"%s\" accessible only using class \"%s\""));
3505 EXTERN char e_object_member_str_accessible_only_using_object_str[] 3505 EXTERN char e_object_member_str_accessible_only_using_object_str[]
3506 INIT(= N_("E1376: Object member \"%s\" accessible only using class \"%s\" object")); 3506 INIT(= N_("E1376: Object member \"%s\" accessible only using class \"%s\" object"));
3507 EXTERN char e_static_member_not_supported_in_interface[]
3508 INIT(= N_("E1377: Static member is not supported in an interface"));
3509 EXTERN char e_method_str_of_class_str_has_different_access[] 3507 EXTERN char e_method_str_of_class_str_has_different_access[]
3510 INIT(= N_("E1378: Access level of method \"%s\" is different in class \"%s\"")); 3508 INIT(= N_("E1377: Access level of method \"%s\" is different in class \"%s\""));
3509 EXTERN char e_static_cannot_be_used_in_interface[]
3510 INIT(= N_("E1378: Static cannot be used in an interface"));
3511 EXTERN char e_private_variable_str_in_interface[]
3512 INIT(= N_("E1379: Private variable not supported in an interface"));
3513 EXTERN char e_private_method_str_in_interface[]
3514 INIT(= N_("E1380: Private method not supported in an interface"));
3515 EXTERN char e_interface_cannot_use_implements[]
3516 INIT(= N_("E1381: Interface cannot use \"implements\""));
3517 EXTERN char e_member_str_type_mismatch_expected_str_but_got_str[]
3518 INIT(= N_("E1382: Member \"%s\": type mismatch, expected %s but got %s"));
3519 EXTERN char e_method_str_type_mismatch_expected_str_but_got_str[]
3520 INIT(= N_("E1383: Method \"%s\": type mismatch, expected %s but got %s"));
3521 #endif
3511 EXTERN char e_cannot_mix_positional_and_non_positional_str[] 3522 EXTERN char e_cannot_mix_positional_and_non_positional_str[]
3512 INIT(= N_("E1400: Cannot mix positional and non-positional arguments: %s")); 3523 INIT(= N_("E1400: Cannot mix positional and non-positional arguments: %s"));
3513 EXTERN char e_fmt_arg_nr_unused_str[] 3524 EXTERN char e_fmt_arg_nr_unused_str[]
3514 INIT(= N_("E1401: format argument %d unused in $-style format: %s")); 3525 INIT(= N_("E1401: format argument %d unused in $-style format: %s"));
3515 EXTERN char e_positional_num_field_spec_reused_str_str[] 3526 EXTERN char e_positional_num_field_spec_reused_str_str[]
3518 INIT(= N_("E1403: Positional argument %d out of bounds: %s")); 3529 INIT(= N_("E1403: Positional argument %d out of bounds: %s"));
3519 EXTERN char e_positional_arg_num_type_inconsistent_str_str[] 3530 EXTERN char e_positional_arg_num_type_inconsistent_str_str[]
3520 INIT(= N_("E1404: Positional argument %d type used inconsistently: %s/%s")); 3531 INIT(= N_("E1404: Positional argument %d type used inconsistently: %s/%s"));
3521 EXTERN char e_invalid_format_specifier_str[] 3532 EXTERN char e_invalid_format_specifier_str[]
3522 INIT(= N_("E1405: Invalid format specifier: %s")); 3533 INIT(= N_("E1405: Invalid format specifier: %s"));
3523 EXTERN char e_member_str_type_mismatch_expected_str_but_got_str[]
3524 INIT(= N_("E1406: Member \"%s\": type mismatch, expected %s but got %s"));
3525 EXTERN char e_method_str_type_mismatch_expected_str_but_got_str[]
3526 INIT(= N_("E1407: Method \"%s\": type mismatch, expected %s but got %s"));
3527 EXTERN char e_aptypes_is_null_nr_str[] 3534 EXTERN char e_aptypes_is_null_nr_str[]
3528 INIT(= "E1408: Internal error: ap_types or ap_types[idx] is NULL: %d: %s"); 3535 INIT(= "E1408: Internal error: ap_types or ap_types[idx] is NULL: %d: %s");
3529 EXTERN char e_interface_static_direct_access_str[] 3536 // E1384 - E1399 unused
3530 INIT(= N_("E1409: Cannot directly access interface \"%s\" static member \"%s\""));
3531 // E1376 - E1399 unused