diff options
author | Dmitrii Maganov <vonagam@gmail.com> | 2022-12-28 07:41:03 +0200 |
---|---|---|
committer | Dmitrii Maganov <vonagam@gmail.com> | 2023-01-06 16:38:22 +0200 |
commit | 532ffc30bdad3e0f279bbaaeb954ca994f98baa5 (patch) | |
tree | 28fe56a853b9700db256b8e034172aef273e4d1a /modules/gdscript/tests/scripts/analyzer/warnings | |
parent | b14f7aa9f92ff44135c283a9c88dab5ef9136d64 (diff) |
GDScript: Fix typing of lambda functions
Diffstat (limited to 'modules/gdscript/tests/scripts/analyzer/warnings')
4 files changed, 21 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/warnings/lambda_shadowing_arg.gd b/modules/gdscript/tests/scripts/analyzer/warnings/lambda_shadowing_arg.gd new file mode 100644 index 0000000000..939496324c --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/warnings/lambda_shadowing_arg.gd @@ -0,0 +1,6 @@ +var shadow: int + +func test(): + var lambda := func(shadow: String) -> void: + print(shadow) + lambda.call('shadow') diff --git a/modules/gdscript/tests/scripts/analyzer/warnings/lambda_shadowing_arg.out b/modules/gdscript/tests/scripts/analyzer/warnings/lambda_shadowing_arg.out new file mode 100644 index 0000000000..a98d80514c --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/warnings/lambda_shadowing_arg.out @@ -0,0 +1,6 @@ +GDTEST_OK +>> WARNING +>> Line: 4 +>> SHADOWED_VARIABLE +>> The local function parameter "shadow" is shadowing an already-declared variable at line 1. +shadow diff --git a/modules/gdscript/tests/scripts/analyzer/warnings/lambda_unused_arg.gd b/modules/gdscript/tests/scripts/analyzer/warnings/lambda_unused_arg.gd new file mode 100644 index 0000000000..6fc90ea29c --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/warnings/lambda_unused_arg.gd @@ -0,0 +1,4 @@ +func test(): + var lambda := func(unused: Variant) -> void: + pass + lambda.call() diff --git a/modules/gdscript/tests/scripts/analyzer/warnings/lambda_unused_arg.out b/modules/gdscript/tests/scripts/analyzer/warnings/lambda_unused_arg.out new file mode 100644 index 0000000000..b018091c18 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/warnings/lambda_unused_arg.out @@ -0,0 +1,5 @@ +GDTEST_OK +>> WARNING +>> Line: 2 +>> UNUSED_PARAMETER +>> |