ruff/crates/ruff_python_semantic/src/analyze
Charlie Marsh 932c9a4789
Extend PEP 604 rewrites to support some quoted annotations (#5725)
## Summary

Python doesn't allow `"Foo" | None` if the annotation will be evaluated
at runtime (see the comments in the PR, or the semantic model
documentation for more on what this means and when it is true), but it
_does_ allow it if the annotation is typing-only.

This, for example, is invalid, as Python will evaluate `"Foo" | None` at
runtime in order to
populate the function's `__annotations__`:

```python
def f(x: "Foo" | None): ...
```

This, however, is valid:

```python
def f():
    x: "Foo" | None
```

As is this:

```python
from __future__ import annotations

def f(x: "Foo" | None): ...
```

Closes #5706.
2023-07-13 07:34:04 -04:00
..
branch_detection.rs Upgrade RustPython (#5192) 2023-06-19 21:09:53 +00:00
function_type.rs Remove some additional manual iterator matches (#5482) 2023-07-03 16:29:59 +00:00
logging.rs Format let-else with rustfmt nightly (#5461) 2023-07-03 02:13:35 +00:00
mod.rs Extract shared simple AST node inference utility (#4871) 2023-06-05 18:23:37 +00:00
type_inference.rs Extract shared simple AST node inference utility (#4871) 2023-06-05 18:23:37 +00:00
typing.rs Extend PEP 604 rewrites to support some quoted annotations (#5725) 2023-07-13 07:34:04 -04:00
visibility.rs Use `matches!` for `CallPath` comparisons (#5099) 2023-06-14 17:06:34 -04:00