summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/scripts/analyzer/features
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/tests/scripts/analyzer/features')
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.gd17
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.out3
2 files changed, 20 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.gd b/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.gd
new file mode 100644
index 0000000000..d678f3acfc
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.gd
@@ -0,0 +1,17 @@
+func test():
+ var instance := Parent.new()
+ var result := instance.my_function(1)
+ print(result)
+ assert(result == 1)
+ instance = Child.new()
+ result = instance.my_function(2)
+ print(result)
+ assert(result == 0)
+
+class Parent:
+ func my_function(par1: int) -> int:
+ return par1
+
+class Child extends Parent:
+ func my_function(_par1: int, par2: int = 0) -> int:
+ return par2
diff --git a/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.out b/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.out
new file mode 100644
index 0000000000..fc5315a501
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_extra_parameters.out
@@ -0,0 +1,3 @@
+GDTEST_OK
+1
+0