summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests/scripts/runtime/features/lambda_get_method.gd
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/tests/scripts/runtime/features/lambda_get_method.gd')
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/lambda_get_method.gd21
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/runtime/features/lambda_get_method.gd b/modules/gdscript/tests/scripts/runtime/features/lambda_get_method.gd
new file mode 100644
index 0000000000..160e43a797
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/lambda_get_method.gd
@@ -0,0 +1,21 @@
+# https://github.com/godotengine/godot/issues/94074
+
+func foo():
+ pass
+
+func test():
+ var lambda_self := func test() -> void:
+ foo()
+ var anon_lambda_self := func() -> void:
+ foo()
+
+ print(lambda_self.get_method()) # Should print "test".
+ print(anon_lambda_self.get_method()) # Should print "<anonymous lambda>".
+
+ var lambda_non_self := func test() -> void:
+ pass
+ var anon_lambda_non_self := func() -> void:
+ pass
+
+ print(lambda_non_self.get_method()) # Should print "test".
+ print(anon_lambda_non_self.get_method()) # Should print "<anonymous lambda>".