1
0
Fork 0
godot/modules/gdscript/tests/scripts/analyzer/errors
George Marques 1ebcb58e69
GDScript: Check if method signature matches the parent
To guarantee polymorphism, a method signature must be compatible with
the parent. This checks if:

1. Return type is the same.
2. The subclass method takes at least the same amount of parameters.
3. The matching parameters have the same type.
4. If the subclass takes more parameters, all of the extra ones have a
default value.
5. If the superclass has default values, so must have the subclass.

There's a few test cases to ensure this holds up.
2022-03-06 11:16:20 -03:00
..
bitwise_float_left_operand.gd
bitwise_float_left_operand.out
bitwise_float_right_operand.gd
bitwise_float_right_operand.out
class_name_shadows_builtin_type.gd
class_name_shadows_builtin_type.out
constant_name_shadows_builtin_type.gd
constant_name_shadows_builtin_type.out
constant_used_as_function.gd
constant_used_as_function.out
dictionary_duplicate_key_lua.gd
dictionary_duplicate_key_lua.out
dictionary_duplicate_key_lua_with_string.gd
dictionary_duplicate_key_lua_with_string.out
dictionary_duplicate_key_python.gd
dictionary_duplicate_key_python.out
enum_class_var_assign_with_wrong_enum_type.gd
enum_class_var_assign_with_wrong_enum_type.out
enum_class_var_init_with_wrong_enum_type.gd
enum_class_var_init_with_wrong_enum_type.out
enum_float_value.gd
enum_float_value.out
enum_local_var_assign_with_wrong_enum_type.gd
enum_local_var_assign_with_wrong_enum_type.out
enum_local_var_init_with_wrong_enum_type.gd
enum_local_var_init_with_wrong_enum_type.out
enum_name_shadows_builtin_type.gd
enum_name_shadows_builtin_type.out
enum_string_value.gd
enum_string_value.out
function_dont_match_parent_signature_parameter_count_less.gd
function_dont_match_parent_signature_parameter_count_less.out
function_dont_match_parent_signature_parameter_count_more.gd
function_dont_match_parent_signature_parameter_count_more.out
function_dont_match_parent_signature_parameter_default_values.gd
function_dont_match_parent_signature_parameter_default_values.out
function_dont_match_parent_signature_parameter_type.gd
function_dont_match_parent_signature_parameter_type.out
function_dont_match_parent_signature_return_type.gd
function_dont_match_parent_signature_return_type.out
function_used_as_property.gd
function_used_as_property.out
invalid_array_index.gd
invalid_array_index.out
invalid_concatenation_bool.gd
invalid_concatenation_bool.out
invalid_concatenation_dictionary.gd
invalid_concatenation_dictionary.out
invalid_concatenation_mixed.gd
invalid_concatenation_mixed.out
invalid_constant.gd
invalid_constant.out
leading_number_separator.gd
leading_number_separator.out
missing_argument.gd
missing_argument.out
params_default_forward_reference.gd
params_default_forward_reference.out
property_function_get_type_error.gd
property_function_get_type_error.out
property_function_set_type_error.gd
property_function_set_type_error.out
property_inline_get_type_error.gd
property_inline_get_type_error.out
property_inline_set_type_error.gd
property_inline_set_type_error.out
property_used_as_function.gd
property_used_as_function.out
redefine_class_constant.gd
redefine_class_constant.out
redefine_local_constant.gd
redefine_local_constant.out
setter_parameter_uses_property_type.gd
setter_parameter_uses_property_type.out
super_nonexistent_base_method.gd
super_nonexistent_base_method.out
variable_name_shadows_builtin_type.gd
variable_name_shadows_builtin_type.out