godotengine / godotengine/godot
`Trying to call an async function without "await".` false positive when calling `Callable.get_object()` on an awaiting callable
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
v4.2.2.stable.official [15073afe3]
v4.3.rc2.official [3978628c6]
### System information
N/A
### Issue description
`awaiting_callable.get_object()` is incorrectly triggering `Trying to call an async function without "await".` error in some specific circumstances, see the snippet below. Seems to happen when it's some operator's operand? :thinking:
### Steps to reproduce
Run:
```gdscript
extends Node
signal _signal
func foo():
await _signal
func _ready():
foo()
var awaiting_callable_typed: Callable = _signal.get_connections()[0].callable
if awaiting_callable_typed.get_object() == null: # OK
pass
var awaiting_callable = _signal.get_connections()[0].callable
if awaiting_callable.get_object() == null: # Error: Trying to call an async function without "await".
pass
awaiting_callable.get_object() # OK
not awaiting_callable.get_object() # Error: Trying to call an async function without "await".
```
### Minimal reproduction project (MRP)
[async_call_with_no_await_fake_error.zip](https://github.com/user-attachments/files/16514502/async_call_with_no_await_fake_error.zip)
Contributor guide
Research direction
Start with the attached minimal reproduction project and trace the async-without-await diagnostic for Callable.get_object(), especially when the call appears as an operator operand. Compare the typed and untyped Callable cases and the direct calls shown in the snippet. Done means valid get_object() calls no longer produce a false-positive diagnostic while genuine missing await errors remain reported.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100