From 4e69341c016c5182c41a563829cae3d619af9bdd Mon Sep 17 00:00:00 2001 From: George Marques Date: Fri, 17 Sep 2021 11:52:30 -0300 Subject: GDScript: Avoid inferred types from giving hard errors --- .../scripts/analyzer/features/auto_inferred_type_dont_error.gd | 9 +++++++++ .../scripts/analyzer/features/auto_inferred_type_dont_error.out | 2 ++ 2 files changed, 11 insertions(+) create mode 100644 modules/gdscript/tests/scripts/analyzer/features/auto_inferred_type_dont_error.gd create mode 100644 modules/gdscript/tests/scripts/analyzer/features/auto_inferred_type_dont_error.out (limited to 'modules/gdscript/tests/scripts/analyzer/features') diff --git a/modules/gdscript/tests/scripts/analyzer/features/auto_inferred_type_dont_error.gd b/modules/gdscript/tests/scripts/analyzer/features/auto_inferred_type_dont_error.gd new file mode 100644 index 0000000000..f64dce26c9 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/auto_inferred_type_dont_error.gd @@ -0,0 +1,9 @@ +func inferred_parameter(param = null): + if param == null: + param = Node.new() + param.name = "Ok" + print(param.name) + param.free() + +func test(): + inferred_parameter() diff --git a/modules/gdscript/tests/scripts/analyzer/features/auto_inferred_type_dont_error.out b/modules/gdscript/tests/scripts/analyzer/features/auto_inferred_type_dont_error.out new file mode 100644 index 0000000000..0e9f482af4 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/auto_inferred_type_dont_error.out @@ -0,0 +1,2 @@ +GDTEST_OK +Ok -- cgit v1.2.3