From 0f27c4ad8079f58d7c6cc86d644a89a78b6e8c79 Mon Sep 17 00:00:00 2001 From: Danil Alexeev Date: Thu, 22 Jun 2023 12:19:14 +0300 Subject: GDScript: Check `get_node()` shorthand in static functions --- .../analyzer/errors/get_node_shorthand_in_static_function.gd | 9 +++++++++ .../analyzer/errors/get_node_shorthand_in_static_function.out | 2 ++ 2 files changed, 11 insertions(+) create mode 100644 modules/gdscript/tests/scripts/analyzer/errors/get_node_shorthand_in_static_function.gd create mode 100644 modules/gdscript/tests/scripts/analyzer/errors/get_node_shorthand_in_static_function.out (limited to 'modules/gdscript/tests/scripts') diff --git a/modules/gdscript/tests/scripts/analyzer/errors/get_node_shorthand_in_static_function.gd b/modules/gdscript/tests/scripts/analyzer/errors/get_node_shorthand_in_static_function.gd new file mode 100644 index 0000000000..caeea46977 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/get_node_shorthand_in_static_function.gd @@ -0,0 +1,9 @@ +# GH-75645 + +extends Node + +static func static_func(): + var a = $Node + +func test(): + pass diff --git a/modules/gdscript/tests/scripts/analyzer/errors/get_node_shorthand_in_static_function.out b/modules/gdscript/tests/scripts/analyzer/errors/get_node_shorthand_in_static_function.out new file mode 100644 index 0000000000..1910b3e66b --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/get_node_shorthand_in_static_function.out @@ -0,0 +1,2 @@ +GDTEST_ANALYZER_ERROR +Cannot use shorthand "get_node()" notation ("$") in a static function. -- cgit v1.2.3