It would be useful for ty to detect cases where a coroutine is called but never awaited — equivalent to mypy's unused-awaitable error code.
async def fetch_data() -> str:
return "data"
async def main() -> None:
fetch_data() # should warn: coroutine is not awaited
result = fetch_data() # should warn: result is Coroutine, not str
Python emits RuntimeWarning: coroutine was never awaited at runtime, but catching this statically is much more valuable — especially for large async codebases or sync-to-async migrations where missed awaits are easy to introduce and hard to spot.
Prior art
- mypy:
unused-awaitable (opt-in via --enable-error-code=unused-awaitable)
- ruff: astral-sh/ruff#9833 (open, but maintainer comments suggest should be here)
- ty: #198 listed this among mypy error codes to reimplement, but was closed as too broad with a suggestion to file individual issues (no one filed for this though, so I am)
Suggested behavior
I would assume opt-in/warning severity
It would be useful for ty to detect cases where a coroutine is called but never awaited — equivalent to mypy's
unused-awaitableerror code.Python emits
RuntimeWarning: coroutine was never awaitedat runtime, but catching this statically is much more valuable — especially for large async codebases or sync-to-async migrations where missedawaits are easy to introduce and hard to spot.Prior art
unused-awaitable(opt-in via--enable-error-code=unused-awaitable)Suggested behavior
I would assume opt-in/warning severity