From 06a2d83e30cab0e1deaf232f7e695eca17ed4659 Mon Sep 17 00:00:00 2001 From: CalebJohn Date: Tue, 3 May 2022 12:43:22 -0700 Subject: Add regression test for gdscript valid function signature Previously, there was an issue where the gdscript analyzer incorrectly riased a validation error for code that had a default Dictionary, Array, or custom type. --- ...nction_match_parent_signature_with_default_dict_void.gd | 14 ++++++++++++++ ...ction_match_parent_signature_with_default_dict_void.out | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_default_dict_void.gd create mode 100644 modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_default_dict_void.out (limited to 'modules/gdscript/tests') diff --git a/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_default_dict_void.gd b/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_default_dict_void.gd new file mode 100644 index 0000000000..631e7be5ce --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_default_dict_void.gd @@ -0,0 +1,14 @@ +func test(): + var instance := Parent.new() + instance.my_function({"a": 1}) + instance = Child.new() + instance.my_function({"a": 1}) + print("No failure") + +class Parent: + func my_function(_par1: Dictionary = {}) -> void: + pass + +class Child extends Parent: + func my_function(_par1: Dictionary = {}) -> void: + pass diff --git a/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_default_dict_void.out b/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_default_dict_void.out new file mode 100644 index 0000000000..67f0045867 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/function_match_parent_signature_with_default_dict_void.out @@ -0,0 +1,2 @@ +GDTEST_OK +No failure -- cgit v1.2.3