microsoft / microsoft/XBOX-Godot-Sample
[Bug]: GameInput stuck actions test file still fails to parse, so its six tests never run
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 236
- Forks
- 21
- Avg merge
- 6h 4m
- Merged PRs (30d)
- 8
Description
What happens
tests/godot/gameinput/tests/test_gameinput_mapper_stuck_actions.gd does not parse, so none of its six tests run. The file is collected, the parse fails, and the run continues without those cases being reported as missing.
Where it stops
The parse fails on the inferred type declarations that call the file's own helpers:
tests/test_gameinput_mapper_stuck_actions.gd:71 - Cannot infer the type of "mapper" variable because the value doesn't have a set type.
tests/test_gameinput_mapper_stuck_actions.gd:72 - Cannot infer the type of "first" variable because the value doesn't have a set type.
tests/test_gameinput_mapper_stuck_actions.gd:73 - Cannot infer the type of "second" variable because the value doesn't have a set type.
13 parse errors in total across the file.
The two helpers those lines call do not declare a return type:
func _new_action_map_with(action: StringName, source_value: int = 2): # line 37
func _new_mapper(): # line 48
A GDScript function with no return annotation is treated as returning Variant, and var x := f() needs a type it can infer, so each call site using := fails.
A comparison in the same directory
test_gameinput_mapper_extensions.gd uses the same helper pattern and parses cleanly. Its helpers are annotated:
func _new_mapper() -> Node:
func _new_action_map_with(action_name: StringName, source_value: int) -> Resource:
Adding equivalent annotations to the stuck actions file, or changing those call sites from := to =, looks like it would be enough. I have not sent a PR in case you would rather fold this into the module rework.
Tests that currently do not run
test_action_map_swap_releases_previous_held_actiontest_active_map_mutations_release_held_actions_and_invalidate_cachetest_binding_property_mutation_releases_held_actiontest_uninitialized_runtime_early_return_releases_held_actiontest_missing_target_device_releases_held_actiontest_non_gamepad_target_without_reading_releases_held_action
These cover the mapper releasing held actions, so that behaviour is currently unverified by the suite.
Reproduces on
4.5.1-stable, 4.6.1-stable and 4.7.1-stable, in both the standard and .NET builds. Same 13 inference errors and a non-zero exit on all six.
How to reproduce
Import the project before checking the script. Without the import pass the GDExtension is not loaded, the super class does not resolve, and that error masks this one:
godot --headless --path tests/godot/gameinput --import
godot --headless --path tests/godot/gameinput --check-only --script res://tests/test_gameinput_mapper_stuck_actions.gd
Note
#162 described this same file failing to parse and is closed. The parse failure still reproduces on current main (f6c1628), so it may be worth reopening that one or tracking it here instead.
Found while running the godot-bvt test harness across the sample's addon and engine matrix.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.