diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2024-07-26 13:44:09 +0200 |
|---|---|---|
| committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-07-26 13:44:09 +0200 |
| commit | b2facc018ab7f155974999eedccda6d7773928f2 (patch) | |
| tree | f15e2194bf5b9a1b24bd7910b1ef8a9a00819a01 /modules/gdscript/tests/scripts/runtime | |
| parent | c331fb096616236ea586d9384f18141c46ddb805 (diff) | |
| parent | 5350e1beaa149725561fde8740e59eca7876394d (diff) | |
| download | redot-engine-b2facc018ab7f155974999eedccda6d7773928f2.tar.gz | |
Merge pull request #94730 from dalexeev/gds-fix-while-locals-clearing
GDScript: Fix locals clearing after exiting `while` block
Diffstat (limited to 'modules/gdscript/tests/scripts/runtime')
| -rw-r--r-- | modules/gdscript/tests/scripts/runtime/features/reset_local_var_on_exit_block.gd | 20 | ||||
| -rw-r--r-- | modules/gdscript/tests/scripts/runtime/features/reset_local_var_on_exit_block.out | 1 |
2 files changed, 19 insertions, 2 deletions
diff --git a/modules/gdscript/tests/scripts/runtime/features/reset_local_var_on_exit_block.gd b/modules/gdscript/tests/scripts/runtime/features/reset_local_var_on_exit_block.gd index c774ebf83c..df639a7b4d 100644 --- a/modules/gdscript/tests/scripts/runtime/features/reset_local_var_on_exit_block.gd +++ b/modules/gdscript/tests/scripts/runtime/features/reset_local_var_on_exit_block.gd @@ -1,6 +1,5 @@ # GH-77666 - -func test(): +func test_exit_if(): var ref := RefCounted.new() print(ref.get_reference_count()) @@ -8,3 +7,20 @@ func test(): var _temp := ref print(ref.get_reference_count()) + +# GH-94654 +func test_exit_while(): + var slots_data := [] + + while true: + @warning_ignore("confusable_local_declaration") + var slot = 42 + slots_data.append(slot) + break + + var slot: int = slots_data[0] + print(slot) + +func test(): + test_exit_if() + test_exit_while() diff --git a/modules/gdscript/tests/scripts/runtime/features/reset_local_var_on_exit_block.out b/modules/gdscript/tests/scripts/runtime/features/reset_local_var_on_exit_block.out index 04b4638adf..164eb24963 100644 --- a/modules/gdscript/tests/scripts/runtime/features/reset_local_var_on_exit_block.out +++ b/modules/gdscript/tests/scripts/runtime/features/reset_local_var_on_exit_block.out @@ -1,3 +1,4 @@ GDTEST_OK 1 1 +42 |
