1
0
Fork 0
godot/modules/gdscript/tests/scripts/analyzer/features
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
..
as.gd
as.out
auto_inferred_type_dont_error.gd
auto_inferred_type_dont_error.out
call_self_get_name.gd
call_self_get_name.out
call_static_builtin_function.gd
call_static_builtin_function.out
class_from_parent.gd
class_from_parent.out
class_inference_is_weak.gd
class_inference_is_weak.out
constants_from_parent.gd
constants_from_parent.out
enum_assign_enum_to_int_typed_var.gd
enum_assign_enum_to_int_typed_var.out
enum_assign_int_cast_to_same_enum.gd
enum_assign_int_cast_to_same_enum.out
enum_assign_other_enum_cast_to_same_enum.gd
enum_assign_other_enum_cast_to_same_enum.out
enum_assign_same_enum.gd
enum_assign_same_enum.out
enum_from_parent.gd
enum_from_parent.out
enum_is_treated_as_int.gd
enum_is_treated_as_int.out
enum_type_is_treated_as_dictionary.gd
enum_type_is_treated_as_dictionary.out
enum_value_from_parent.gd
enum_value_from_parent.out
function_match_parent_signature_with_extra_parameters.gd
function_match_parent_signature_with_extra_parameters.out
gdscript_to_preload.gd
gdscript_to_preload.out
inner_class_as_return_type.gd
inner_class_as_return_type.out
local_inference_is_weak.gd
local_inference_is_weak.out
property_functions.gd
property_functions.out
property_inline.gd
property_inline.out
static_method_builtin_type.gd
static_method_builtin_type.out
subscript_self.gd
subscript_self.out
typed_array_inferred_access_isnt_constant.gd
typed_array_inferred_access_isnt_constant.out
typed_array_with_custom_class.gd
typed_array_with_custom_class.out
use_preload_script_as_type.gd
use_preload_script_as_type.out
warning_ignore_annotation.gd
warning_ignore_annotation.out