-
Notifications
You must be signed in to change notification settings - Fork 216
Closed
Labels
diagnosticsRelated to reporting of diagnostics.Related to reporting of diagnostics.good first issueGood for newcomersGood for newcomers
Description
We currently don't emit any errors in await xyz expressions if xyz is not awaitable. We should probably do something similar to what we do for iterators or context managers, where we emit helpful diagnostics if calls to respective dunder methods fail. For example:
class NotAwaitable: ...
class NotAwaitable2:
# not async!
def __await__(self):
pass
async def main():
x = await 1 # should be an error
y = await NotAwaitable() # should be an error
z = await NotAwaitable2() # should be an errorThe entrypoint to implement this is here: https://github.com/astral-sh/ruff/blob/27b03a9d7bf779049585bb6cfbf229f18352572d/crates/ty_python_semantic/src/types.rs#L4868
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
diagnosticsRelated to reporting of diagnostics.Related to reporting of diagnostics.good first issueGood for newcomersGood for newcomers