diff options
| author | Danil Alexeev <danil@alexeev.xyz> | 2023-08-23 12:37:18 +0300 |
|---|---|---|
| committer | Danil Alexeev <danil@alexeev.xyz> | 2023-08-25 16:29:11 +0300 |
| commit | 89429b0273a3358f4a0a283abf7efa7fcb4e5e4c (patch) | |
| tree | fa92cea3947e222bedf4fa3ff69fb3d45921a269 /modules/gdscript/tests/scripts/analyzer/features/lambda_cyclic_ref_body.gd | |
| parent | 6758a7f8c07d1f4c8ec4f052ded6d26402967ebe (diff) | |
| download | redot-engine-89429b0273a3358f4a0a283abf7efa7fcb4e5e4c.tar.gz | |
GDScript: Fix lambda resolution with cyclic references
Diffstat (limited to 'modules/gdscript/tests/scripts/analyzer/features/lambda_cyclic_ref_body.gd')
| -rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/lambda_cyclic_ref_body.gd | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/features/lambda_cyclic_ref_body.gd b/modules/gdscript/tests/scripts/analyzer/features/lambda_cyclic_ref_body.gd new file mode 100644 index 0000000000..e2f41a652c --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/lambda_cyclic_ref_body.gd @@ -0,0 +1,34 @@ +# GH-70592 + +var f: Callable = func (): + x = 2 + return 1 + +var x: int = f.call() + +var g: Array[Callable] = [ + func (): + y += 10 + return 1, + func (): + y += 20 + return 2, +] + +var y: int = g[0].call() + g[1].call() + +func test(): + print(x) + f.call() + print(x) + + print(y) + g[0].call() + g[1].call() + print(y) + + # This prevents memory leak in CI. TODO: Investigate it. + # Also you cannot run the `EditorScript` twice without the cleaning. Error: + # Condition "!p_keep_state && has_instances" is true. Returning: ERR_ALREADY_IN_USE + f = Callable() + g.clear() |
