summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests/scripts/parser
diff options
context:
space:
mode:
authorDanil Alexeev <danil@alexeev.xyz>2023-09-21 12:42:55 +0300
committerDanil Alexeev <danil@alexeev.xyz>2023-09-21 13:36:39 +0300
commite8696f9961e4d317f56ceb9626792529966f0e91 (patch)
treea6fe0815ae249234ad93beeb6ee0b39fd9383134 /modules/gdscript/tests/scripts/parser
parent59139df16e7a10c3b9176f697d23b557af46601e (diff)
downloadredot-engine-e8696f9961e4d317f56ceb9626792529966f0e91.tar.gz
GDScript: Improve call analysis
* Add missing `UNSAFE_CALL_ARGUMENT` warning. * Fix `Object` constructor. * Display an error for non-existent static methods.
Diffstat (limited to 'modules/gdscript/tests/scripts/parser')
-rw-r--r--modules/gdscript/tests/scripts/parser/features/dollar_and_percent_get_node.gd5
-rw-r--r--modules/gdscript/tests/scripts/parser/features/dollar_node_paths.gd2
-rw-r--r--modules/gdscript/tests/scripts/parser/features/lambda_ends_with_new_line.gd1
-rw-r--r--modules/gdscript/tests/scripts/parser/features/nested_function_calls.gd1
-rw-r--r--modules/gdscript/tests/scripts/parser/features/super.gd1
-rw-r--r--modules/gdscript/tests/scripts/parser/features/unicode_identifiers.gd1
6 files changed, 11 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/parser/features/dollar_and_percent_get_node.gd b/modules/gdscript/tests/scripts/parser/features/dollar_and_percent_get_node.gd
index f04f4de08d..19f6e08285 100644
--- a/modules/gdscript/tests/scripts/parser/features/dollar_and_percent_get_node.gd
+++ b/modules/gdscript/tests/scripts/parser/features/dollar_and_percent_get_node.gd
@@ -3,27 +3,32 @@ extends Node
func test():
var child = Node.new()
child.name = "Child"
+ @warning_ignore("unsafe_call_argument")
add_child(child)
child.owner = self
var hey = Node.new()
hey.name = "Hey"
+ @warning_ignore("unsafe_call_argument")
child.add_child(hey)
hey.owner = self
hey.unique_name_in_owner = true
var fake_hey = Node.new()
fake_hey.name = "Hey"
+ @warning_ignore("unsafe_call_argument")
add_child(fake_hey)
fake_hey.owner = self
var sub_child = Node.new()
sub_child.name = "SubChild"
+ @warning_ignore("unsafe_call_argument")
hey.add_child(sub_child)
sub_child.owner = self
var howdy = Node.new()
howdy.name = "Howdy"
+ @warning_ignore("unsafe_call_argument")
sub_child.add_child(howdy)
howdy.owner = self
howdy.unique_name_in_owner = true
diff --git a/modules/gdscript/tests/scripts/parser/features/dollar_node_paths.gd b/modules/gdscript/tests/scripts/parser/features/dollar_node_paths.gd
index 8ba558e91d..3d9404b20b 100644
--- a/modules/gdscript/tests/scripts/parser/features/dollar_node_paths.gd
+++ b/modules/gdscript/tests/scripts/parser/features/dollar_node_paths.gd
@@ -5,9 +5,11 @@ func test():
# Create the required node structure.
var hello = Node.new()
hello.name = "Hello"
+ @warning_ignore("unsafe_call_argument")
add_child(hello)
var world = Node.new()
world.name = "World"
+ @warning_ignore("unsafe_call_argument")
hello.add_child(world)
# All the ways of writing node paths below with the `$` operator are valid.
diff --git a/modules/gdscript/tests/scripts/parser/features/lambda_ends_with_new_line.gd b/modules/gdscript/tests/scripts/parser/features/lambda_ends_with_new_line.gd
index df6001c7e2..f16c768f7f 100644
--- a/modules/gdscript/tests/scripts/parser/features/lambda_ends_with_new_line.gd
+++ b/modules/gdscript/tests/scripts/parser/features/lambda_ends_with_new_line.gd
@@ -26,6 +26,7 @@ func test():
if true: (v as Callable).call()
print()
+ @warning_ignore("unsafe_call_argument")
other(v)
print()
diff --git a/modules/gdscript/tests/scripts/parser/features/nested_function_calls.gd b/modules/gdscript/tests/scripts/parser/features/nested_function_calls.gd
index 59cdc7d6c2..31de73813f 100644
--- a/modules/gdscript/tests/scripts/parser/features/nested_function_calls.gd
+++ b/modules/gdscript/tests/scripts/parser/features/nested_function_calls.gd
@@ -2,4 +2,5 @@ func foo(x):
return x + 1
func test():
+ @warning_ignore("unsafe_call_argument")
print(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(foo(0)))))))))))))))))))))))))
diff --git a/modules/gdscript/tests/scripts/parser/features/super.gd b/modules/gdscript/tests/scripts/parser/features/super.gd
index f5ae2a74a7..33accd92a9 100644
--- a/modules/gdscript/tests/scripts/parser/features/super.gd
+++ b/modules/gdscript/tests/scripts/parser/features/super.gd
@@ -36,6 +36,7 @@ class SayNothing extends Say:
print("howdy, see above")
func say(name):
+ @warning_ignore("unsafe_call_argument")
super(name + " super'd")
print(prefix, " say nothing... or not? ", name)
diff --git a/modules/gdscript/tests/scripts/parser/features/unicode_identifiers.gd b/modules/gdscript/tests/scripts/parser/features/unicode_identifiers.gd
index 523959a016..20cc0cee2e 100644
--- a/modules/gdscript/tests/scripts/parser/features/unicode_identifiers.gd
+++ b/modules/gdscript/tests/scripts/parser/features/unicode_identifiers.gd
@@ -29,6 +29,7 @@ func test():
const d = 1.1
_process(d)
+ @warning_ignore("unsafe_call_argument")
print(is_equal_approx(ㄥ, PI + (d * PI)))
func _process(Δ: float) -> void: